Edit; not bytecode, thanks
Edit; not bytecode, thanks
The ecosystem can be somewhat confusing, because much of what would look like abandoned packages in most ecosystems are more like completed packages, but speed hasn't been a real failing of Common Lisp for a long time now. Talked about a ton, of course.
Fennel piggy-backs on a known and widely deployed language / VM.
This gives them different capabilities, and very different possible adoption curves.
As a matter of fact the only game in town for embedding CL code is ECL which: 1) relies on the Bohem garbage collector 2) is LGPL licensed
Both points have cons which might discourage embedding of Common Lisp code in other applications. Matters would be different if there was something like a CL to C transplier adopting a generational GC distributed with a MIT/BSD like license.
So yeah, blazing fast, with a decent macro system and fixing some of the odd corners of Lua at compile time. It's really a great little thing (it's 2k lines of lua, so super easy to embed/ship too).
There are at least two other Lisps in Lua
[Edit] I recalled this older HN thread with some relevant information: https://news.ycombinator.com/item?id=16566825
tl;dr Urn is a much bigger language that happens to compile to Lua as an implementation detail. Fennel is much closer to Lua and is dramatically simpler, only diverging from Lua semantics when the changes can be implemented purely at compile time. (immutable locals, blocking accidental global references/setting, etc) The compiler output from Fennel tends to be pretty readable and looks a lot like the input.
If you need to write code that runs in the browser, Lumen is one choice, but you can also run Fennel in the browser using Fengari: https://fengari.io/ I know next to nothing about frontend development but was able to integrate Fengari into https://fennel-lang.org to get the live REPL working with ease.
https://news.ycombinator.com/item?id=17958650
are swaying me to spend some time with Lumen this weekend to understand how it compares to Fennel. The Lumen examples were pretty impressive and it works for JavaScript too.
> (fn fib [n]
(if (< n 2)
n
(+ (fib (- n 1)) (fib (- n 2)))))
which seemed to take, but then upon trying (print (fib 10))
it spit out the following: [string "return print(fib(10))"]:1: attempt to call a nil value (global 'fib')
Do I need to initialize fib before in the repl?I like Lua quite a bit and it is of course, extremely fast, but I wish there were good "batteries" along with other stuff that I've come to expect from Python/Ruby et all. Of course, I've coded up some of those libraries myself as well. :)
Just wondering what people's general thoughts on this are.
[1] jsoftware.comBit odd statement, considering that LuaJIT afaik targets Lua 5.1 compatibility with some 5.2 extensions, while main Lua is currently at 5.3. I guess the question is what version Fennel is targeting
It works great with Fengari for client-side scripting; in fact this is what we use on the web site for the live REPL. We have run some tests against other obscure implementations such as Luerl and Rembulan but have encountered some bugs in those compilers that need to get addressed before they get integrated into the test suit.
sorry what ? where does this meme comes from ? Most CL implementations are at best multiple times slower than your average JITted language
Maybe you could post some links to benchmarks that demonstrate your claim.
(I recognize this is unscientific and anecdotal, but I'm just trying to point out that it would take significant evidence to convince me SBCL is faster than Luajit, because my experience is the opposite.)
http://factor-language.blogspot.com/2010/05/comparing-factor...
All four languages have improved over the last 8 years, but you can see SBCL and LuaJIT are in the same ball park, each winning on some tests. My recollection is that SBCL usually "wins" in the number heavy tests like Mandelbrot, but I don't have time to dig up the links.
https://old.reddit.com/r/programming/comments/6eg0x/where_ar...
> the inner loop of mandelbrot is now identical (at the ucode IR level) to the IR generated by a C compiler. All type checks have been eliminated and only the pure (statically typed) FP adds/multiplies are left (the remaining task is to transform the ucode to the best possible machine code -- working on it). Similar results can be obtained for other numeric loops.
^ This is from a ten-year-old post about LuaJIT optimizations.
Regardless, though, I think it’s clear that there are already fast Lisps.
I might try again with a different program.