6 ms·
I pine for a Lisp with the embeddable ease of Lua.
by sillysaurus2 13y ago
I pine for a Lisp with the embeddable ease of Lua.
- wcummings 13y agoGuile? http://www.gnu.org/software/guile/ http://www.gnu.org/software/guile/
- yoklov 13y agoUnfortunately, Guile is both larger, and less portable than Lua. It's also licensed under the LGPL, which is harder (or impossible) to use in some environments than Lua's MIT-like license.
- pygy_ 13y agoIt could be trivially implemented in Lua as a pre-processor. Lua has lambdas, higher level functions, lexical scope and tail call elimination. The main problem is that it doesn't have a ternary operator, making conditional expression problematic to represent (you have to wrap an if statement in a lambda called on the fly). For something more fully featured, see [0], it is written in MoonScript (which itself compiles to Lua), and the parser depends on LPeg, but writing a S-expression parser is rather easy. Edit: There's also lcl [1], which is implemented in C. Written by lhf, one of the Lua authors. From the test files, it looks very basic. -- [0] https://github.com/leafo/moonlisp/tree/master/lisp https://github.com/leafo/moonlisp/tree/master/lisp [1] http://www.drdobbs.com/open-source/lua-an-extensible-embedded-language/184410014 http://www.drdobbs.com/open-source/lua-an-extensible-embedde...
- _mpu 13y agoWrapping an if in a lambda is unlikely to work as expected.
- pygy_ 13y ago((if foo + -) 4 6) Can be compiled to (function() if foo then return plus else return minus end end)()(4, 6) It is far too verbose to be used in manually crafted Lua, but acceptable if you treat it as a compiler target (with the caveat that the lambda creation will prevent LuaJIT from JITting that piece of code).
- meric 13y agoPlug https://github.com/meric/l2l https://github.com/meric/l2l "A object-oriented, unicode-enabled lisp that compiles to and runs as fast as Lua. Equipped with macros and compile-time compiler manipulation. Comes with all built-in Lua functions."
- yoklov 13y agoChibiScheme (https://code.google.com/p/chibi-scheme/ https://code.google.com/p/chibi-scheme/) tries to be that. I've considered using it but have avoided it due to its relative newness and a few portability issues.
- gregburd 13y agoLysp (http://piumarta.com/software/lysp/ http://piumarta.com/software/lysp/) is fairly close to what I'm guessing you're "pining" for and if not, hey it's open source so have at it!
- yoklov 13y agoLysp uses a lot of non-standard (and rarely implemented) extensions, and so would be very hard to use in most places. The author's own Maru (http://piumarta.com/software/maru/ http://piumarta.com/software/maru/) might be better suited for this, but I'm not sure..
- chalst 13y agoAlex Shinn's Chibi scheme, weighing in at 50kB (but with a dependency on the Boehm garbage collector, which weighs >1 Mb ...), might fit the bill. Some links 1. Andy Wingo (main Guile implemetor)'s "buyer's guide" to Scheme implementations - http://wingolog.org/archives/2013/01/07/an-opinionated-guide-to-scheme-implementations http://wingolog.org/archives/2013/01/07/an-opinionated-guide... 2. Chibi Scheme homepage - http://synthcode.com/scheme/chibi/ http://synthcode.com/scheme/chibi/
- outworlder 13y agoThere's also Chicken Scheme. While maybe not as tiny as Lua, it is designed to be embeddable out of the box. The FFI is very simple.