Skip to content

Instantly share code, notes, and snippets.

@russolsen
Created September 3, 2013 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save russolsen/6423293 to your computer and use it in GitHub Desktop.
Save russolsen/6423293 to your computer and use it in GitHub Desktop.
The key function in cloforth
(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