Created
September 3, 2013 12:29
-
-
Save russolsen/6423293 to your computer and use it in GitHub Desktop.
The key function in cloforth
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
(defn repl [env] | |
(let [dictionary (:dictionary env)] | |
(if (:quit env) | |
env | |
(let [r (:in env) | |
compiled (comp/compile-statement r dictionary)] | |
(if (and (coll? compiled) (empty? compiled)) | |
env | |
(let [result (exec/execute-program env compiled) ;; Get the lazy sequence of states | |
new-env (last result)] ;; ... and then the last one | |
(recur new-env))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment