Neat! How would you differentiate picolisp from say, Clojure (which also interoperates well with Java libraries). When would you use picolisp vs Clojure?
#;1> (define (make-counter)
(let ((i 0))
(lambda () (set! i (+ i 1)) i))))
#;2> (define counter (make-counter))
#;3> (counter)
1
#;4> (counter)
2
#;5> (counter)
3
To this PicoLisp one: ? (de make-counter ()
(let (i 0)
'(() (setq i (+ i 1)) i)))
-> make-counter
? (setq counter (make-counter))
-> (NIL (setq i (+ i 1)) i)
? (counter)
-> NIL
? (setq i 10)
-> 10
? (counter)
-> 11
Using `curry` and patterns, you can do substitutions into a "lambda", which
can look like a closure, or not: ? (de make-adder (@base)
(curry (@base) (n) (+ @base n)))
-> make-adder
? (setq add-three (make-adder 3))
-> ((n) (+ 3 n))
? (add-three 5)
-> 8
? (de make-counter ()
(let (@i 0)
(curry (@i) () (setq @i (+ @i 1)) @i)))
-> make-counter
? (setq counter (make-counter))
-> (NIL (setq 0 (+ 0 1)) 0)
? (counter)
!? (setq 0 (+ 0 1))
0 -- Variable expected ; oops, we're trying to redefine 0The Ersatz version has good Java integration. The 64-bit version has some more recent Java integration:
https://news.ycombinator.com/item?id=12363608
I think Clojure has much tighter Java interop, which you might like or loathe.
However, nowadays, I think Erzats PicoLisp, AKA the Java version of PicoLisp, gots too little love. It's an interesting way of accessing the JVM, just like Groovy or Clojure. Also, I don't have benchmarks, but PicoLisp is pretty damn fast owing to minimal datastructures and I would expect that to spill over into the Java implementation.