Search code examples
lispcommon-lispparenscript

lisp: building a repl for parenscript


I've been working to learn Parenscript, but I'm finding that the tutorial is more of a how-to for running a web server.

Does there already exist, or is it possible to create, a REPL so that I can see the actual javascript that is output when calling Parenscript methods?


Solution

  • There is the obvious:

    (loop (print (ps:ps* (read))))

    But I prefer having a form that I can edit in a buffer and just macroexpand-1 (C-c ret on the opening paren):

    (defmacro js-func (name &body body)
      (let ((code (ps* `(progn ,@body))))
        `(defun ,name ()
           ,code))))