Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You can also write your own dialect of lisp within elisp, too. I ported Lumen[1] to emacs: 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

(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



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: