3 ms·
You can also write your own dialect of lisp within elisp, too. I ported Lumen[1] to emacs: https://github.com/shawwn/y/blob/abcf6f4406178880390308ff0b782a5ed516
by sillysaurusx 6y ago
You can also write your own dialect of lisp within elisp, too. I ported Lumen[1] to emacs: https://github.com/shawwn/y/blob/abcf6f4406178880390308ff0b782a5ed516c688/y.el#L251-L263 https://github.com/shawwn/y/blob/abcf6f4406178880390308ff0b7...
(define-global cut (x &optional from upto)
(with l (dup x)
(let (j 0
i (if (or (nil? from) (< from 0)) 0 from)
n (\# x)
upto (if (or (nil? upto) (> upto n)) n upto))
(while (< i upto)
(set (at l j) (at x i))
(inc i)
(inc j))
(each (k v) x
(unless (number? k)
(set (get l k) v))))))
The destructuring LET is so nice.
Emacs' reader can also be completely overridden by user code. I used this technique to port pg's Arc to elisp: https://repl.it/repls/UnluckySturdyCharactercode#main.el https://repl.it/repls/UnluckySturdyCharactercode#main.el
(If you click "run" and type #\a you'll notice you get "a" rather than a syntax error.)
[1] Lumen lisp: https://github.com/sctb/lumen https://github.com/sctb/lumen