Run lisp (LSharp) in node.js with edge.js.
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
});
$ npm install edge
$ npm install edge-lsharp
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
});
MIT