One of the benefits of using Mathematica is its speed. This can be augmented by adding parallelization. It's not difficult, but there are a few things to remember.
We must first have Clojuratica and Mathematica talking to each other. Either complete the Setting up Mathematica to talk to Clojuratica for Mac OS X and Linux recipe or the Setting up Mathematica to talk to Clojuratica for Windows recipe. Also, you'll need to have the init-mma
function called.
Also, make sure that the clojuratica
namespace is imported into our script or REPL.
(use 'clojuratica)
Executing functions in Mathematica isn't as straightforward as doing it in Clojure is.
Before we parallelize any task, we have to initialize Mathematica for this by calling its
LaunchKernels
function.(math (LaunchKernels))
Now, for simple parallelization, we can use some functions that are designed specifically for this, such as
ParallelMap
. This is similar to Clojure's...