Skip to content

Instantly share code, notes, and snippets.

@legumbre
Created October 9, 2011 23:18
Show Gist options
  • Select an option

  • Save legumbre/1274351 to your computer and use it in GitHub Desktop.

Select an option

Save legumbre/1274351 to your computer and use it in GitHub Desktop.
;; Parenscript example
;;; /tmp/foo.lisp
(defun foo-bar-baz ()
"foo bar baz"
(mapcar (lambda (x) (+ 1 x)) (list 1 2 3)))
;; compile foo.lisp to foo.js
(with-open-file (stream "/tmp/foo.js" :direction :output :if-exists :supersede)
(format stream (ps-compile-file "/tmp/foo.lisp")))
;; compile Parenscript runtime library
;; (provides mapcar and other HOFs)
(with-open-file (stream "/tmp/runtime.js" :direction :output :if-exists :supersede)
(format stream (ps* *ps-lisp-library*)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment