Created
November 29, 2010 19:24
-
-
Save eschulte/720413 to your computer and use it in GitHub Desktop.
Lisp interpreter in 4 lines of Clojure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env clj-env | |
;; -*- mode: clojure -*- | |
(loop [expr ""] | |
(when-let [l (str expr " " (read-line))] | |
(recur (if (apply = (map (comp count #(filter (partial = %) l)) [\( \)])) | |
(do (println (eval (read-string l))) "") l)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment