julia-bridge
Call Julia code directly from Node.
npm install julia-bridge
API
compute()
Computes a value and returns it on a callback.
Unfortunately you have to also subscribe to the error
stream if you want errors; this does not currently deliver
node-style callbacks (i.e. with any errors as first arg).
JuliaProcess = require 'julia-bridge'julia = PROGRAM = """ function fib(n) if n <= 2 1 else fib(n-1) + fib(n-2) end end return fib(10)""" juliaon 'ready'-> juliacompute PROGRAM consolelog"Fibonacci value #10 = "
Or, if you prefer the FRP style:
juliareadyflatMap -> juliacompute PROGRAM map consolelog"Fibonacci value #10 = "
send()
Sends your code to Julia. You must explicitly
@emit
any events that you wish to send back to Node.
juliaon 'foo' consolelog "Result reported: " juliasend """ @emit 'foo' longRunningComputation()"""
or as streams:
juliastream'foo'onValue consolelog "Result reported: "