1. 10

repl.it released support for Emacs Lisp: https://twitter.com/amasad/status/1143595381789347840

So I thought I’d dust off my old elisp hack and post it here.

Instructions:

  1. Go to https://repl.it/repls/UnluckySturdyCharactercode

  2. press the run button

  3. evaluate (setq-local lexical-binding t)

  4. now you can run most Scheme expressions via the (scheme …) macro, and most arc expressions via the (arc …) macro.

> (setq-local lexical-binding t)
t
> (arc
   (def adder (n)
      (fn (x) (+ x n)))

   (= add2 (adder 2))

   (add2 3))
5
> (scheme
   (define (adder n)
     (lambda (x) (+ x n)))

   (define add2 (adder 2))

   (add2 40))
42

You can refer to elisp functions by surrounding them in with |bars|:

>  (scheme
      (|print| "Hello"))
"Hello"

> (arc (|buffer-string|))
#("GNU Emacs 25.2.2\n*** Welcome to IELM ***  Type (describe-mo\
de) for help.\n ;; Hint: ....

The original goal was to provide a realistic way of writing Emacs packages in languages other than Emacs Lisp. By “realistic,” I mean that it should be basically a thin syntax wrapper over emacs lisp, not a separate runtime environment. That way you can call Emacs Lisp functions from Arc, call Arc functions from elisp lambdas, and so on.

This project comes pretty close to that goal. I never got around to releasing it or putting it up on github. https://github.com/shawwn/y/blob/abcf6f4406178880390308ff0b782a5ed516c688/y.el is probably better for that purpose anyway.

It overrides the default Emacs Lisp reader to support Scheme syntax, which is a testament to how flexible elisp actually is. (It also might be some combination of scary and horrible, depending on who the emotions are being experienced by.)

For what it’s worth, feel free to take any part of the code and use it however you want.

There is a version of this that contains most of the old Hacker News codebase. It was hilarious seeing Emacs Lisp generate nearly identical output to Racket. And it’d be fairly straightforward to connect this to an http socket and serve something similar to http://arclanguage.org/forum from an Emacs-powered webserver.

  1.