julia-bridge
Julia-JavaScript bridge
Last updated 6 years ago by baconscript .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install julia-bridge 
SYNC missed versions from official npm registry.

julia-bridge

Call Julia code directly from Node.

npm install julia-bridge

NPM package Build Status

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 = new JuliaProcess

PROGRAM = """
  function fib(n)
    if n <= 2
      1
    else
      fib(n-1) + fib(n-2)
    end
  end
  return fib(10)
"""

julia.on 'ready', ->
  julia.compute PROGRAM, (result) ->
    console.log("Fibonacci value #10 = #{result}")

Or, if you prefer the FRP style:

julia.ready.flatMap ->
    julia.compute PROGRAM
  .map (result) ->
    console.log("Fibonacci value #10 = #{result}")

send()

Sends your code to Julia. You must explicitly @emit any events that you wish to send back to Node.

julia.on 'foo', (message) ->
  console.log "Result reported: #{message}"

julia.send """
  @emit 'foo' longRunningComputation()
"""

or as streams:

julia.stream('foo').onValue (message) ->
  console.log "Result reported: #{message}"

Current Tags

  • 0.3.0                                ...           latest (6 years ago)

7 Versions

  • 0.3.0                                ...           6 years ago
  • 0.2.1                                ...           6 years ago
  • 0.2.0                                ...           6 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
  • 0.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 7
Dependencies (3)
Dev Dependencies (3)
Dependents (2)

Copyright 2014 - 2017 © taobao.org |