edge-lsharp

1.0.1 • Public • Published

edge-lsharp

Run lisp (LSharp) in node.js with edge.js.

Example

Write a factorial function in lisp, and call it from JavaScript:

var edge = require('edge');
var fact = edge.func('lsharp', function(){/*
 
(def fact(n) 
    (if (is n 0) 1 (* n (fact (- n 1)))))
 
*/});
 
fact([5], function(err, answer){
    console.log(answer);
    // = 120
});

Installation

$ npm install edge
$ npm install edge-lsharp

Usage

Pass the lisp code in as either a comment (as above), a string, or a filename (as below):

var edge = require('edge');
var lisp = edge.func('lsharp', 'lisp-func.ls');
 
lisp(['arg1', 'arg2'], function(err, result){
    
});

Evaluate a function in lisp, and write to the console:

var edge = require('edge');
var ls = edge.func('lsharp', '(prn "Hello, World")');
 
ls([], function(err){
    // Hello, World
});

License

MIT

Package Sidebar

Install

npm i edge-lsharp

Weekly Downloads

0

Version

1.0.1

License

MIT

Last publish

Collaborators

  • richard.astbury