by haspok · 3y ago · 0 comments
It is more of a Python with a LISP syntax.
It has some of the affordances of the former in terms of semantics, but is stripped down and friendly like Lua.
The use cases also seem to overlap with Lua, as a fast, embeddable scripting language that you can easily keep in your head (see docs).
It seems to be simpler than Lua because it doesn’t complect arrays and dicts into tables, as arrays are a separate construct. And it affords you with immutable versions of those.
To me it looks like a Clojure-like for Lua use cases.
[^1]: https://janet-lang.org/docs/data_structures/index.html
Closure is not a language so hopefully not?
> the language has matching immutable data structures for mutable ones [^1]
Looking at the lingo being used, the extremely limited breadth of ABI, and the complexity they assert around "immutable" data structures, they're clearly imperative data structures you can't mutate rather than the persistent data structures you'd expect from a strong clj inspiration.
This page looks a lot more like a description of python datatypes than clojure, the only bit that Python lacks is an official frozendict.
Very true, the typo is strong in this one.
> rather than the persistent data structures you'd expect from a strong clj inspiration
What do you mean by persistent here? I assume some kind of shared memory instead of copying? Or something with more practical implications like deep immutability?
> looks a lot more like a description of Python datatypes
I am surprised where this sentiment comes from. Because of the initial comment? Basically any language nowadays has maps, sequences and byte strings. If I had to draw a similarity to Python it would be something along the lines of first-class generators.
I mean the class of data structures called persistent: https://en.wikipedia.org/wiki/Persistent_data_structure
> I assume some kind of shared memory instead of copying?
Sure.
> I am surprised where this sentiment comes from. Because of the initial comment?
Because "tuple" for an immutable sequence is rather specific to Python.
And data structures related to clojure (or functional languages in general) would have some sort of logarithmic component because they'd be tree-based. Pretty much the only O(1) operation in functional data structures is prepending to a linked list.
The author also wrote fennel, a lisp/clojure-ish wrapper for lua, so I think that's the influence.
Except they're not immutable in the clojure sense (of persistent data structures), they're just fozen / readonly, as can be seen from their complexity bounds (and the lack of transients). And a quick check didn't show any incompatibility between the two worlds either.