lisp: building a repl for parenscript

156 views Asked by At

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?

1

There are 1 answers

0
pjstirling On BEST ANSWER

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))))