by pmoriarty · 3y ago · 0 comments
Though arguably lispy, Janet just wasn't lispy enough for me. It was missing the simple, elegant sexp syntax I dearly loved, and I started to wonder what huge win I was getting from using it instead of just using Lisp or Scheme? Having not found a good answer, I did just that.
That was the last time I bothered trying to learn a "Lisp-like" language that wasn't actually a Lisp, and decided to just stick to Lisp/Scheme. They do everything I need, are good at math, and are plenty fast enough for me.
In what sense does Janet not have sexp syntax? Seems plenty sexpy to me. Purists seem to say it's not a lisp because its underlying data structure is not (cons-based) lists as in classical lisp, but I don't see what syntactic difference there is.
I wish I could take it back, but HN won't let me delete my post. I apologize. Mea culpa.
Those extra bits of syntax that makes it "not a lisp" are mostly around defining "not list" kind if data structures. I find it practical.
What Janet makes a 'not really a Lisp' is that "LISP" stands for "List Processor". Janet isn't exactly that, since it is not using linked lists as a core data structure - unlike Lisp where its List Processing features are built on top of linked lists made of cons cells.
(1 2 3) is called a "tuple" in Janet and represents something like an immutable array.
CL-USER 40 > (rest '(1 2 3))
(2 3)
Above REST operation does not allocate any memory. CL-USER 41 > (subseq '#(1 2 3) 1)
#(2 3)
Above SUBSEQ returns a new vector. Alternatively it would need a more clever implementation underneath.OTOH getting a random element has a different complexity in a linked list vs. a vector.
You could fill that with linked list nodes, but it would be pointless.
Or maybe your particular Scheme has all of that out of the box, too. Which one do you normally use, if you don't mind?