A "core" library for Fennel. Very much a work-in-progress.
Cljlib reproduces much much of clojure.core than Bulb does. It includes a number of features, data structures, and macros that Bulb does not, e.g. multi-arity functions, sets, multimethods, when-let (and relatives).
Bulb is not nearly as fully-featured as Cljlib, though it is also inspired by Clojure. A main difference between the two libraries is that Cljlib's sequences are primarily based around tables (and are more or less eager), while Bulb's are implemented using Lua iterators, making them lazy.
Bulb and Luafun have a lot of overlap in terms of both functionality and -- in my own benchmarking -- speed (similar on Luajit, and Bulb seems to be a bit faster on Lua 5.4, perhaps since luafun is optimized for Luajit).
Luafun uses a slightly different iteration protocol, storing state in the control variable that you are supposed to ignore. This allows Luafun to return stateless iterators (as long as the source iterator is stateless), which have some benefits.
Bulb works exclusively with stateful iterators, and returns iterators that
work with Lua's normal iteration protocol (i.e. you can use then with the
generic for
), though you have to wrap Lua's stateless iterators (e.g. pairs
and ipairs
) in order to use them.
Copyright © 2021 Mike Richards
Released under the MIT license.