Created
June 30, 2009 06:48
-
-
Save fffej/138036 to your computer and use it in GitHub Desktop.
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 run-machine | |
"Run the virtual machine with the decoded instructions. | |
Reset the program counter when complete" | |
[vm ops update-input] | |
(update-input vm) | |
(doseq [[op args] ops] | |
(apply op (list vm args)) ;; dodgy side effect | |
(swap! (:counter vm) inc)) | |
(swap! (:counter vm) (constantly 0)) | |
(swap! (:firstrun vm) (constantly false)) | |
vm) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment