comparison clojure/com/aurellem/gb_driver.clj @ 74:aaddd7b72a0e

added optional argument to rewind
author Robert McIntyre <rlm@mit.edu>
date Thu, 08 Mar 2012 04:40:18 -0600
parents 8a895ed4c0f9
children eb7d4efe0f34
comparison
equal deleted inserted replaced
73:8a895ed4c0f9 74:aaddd7b72a0e
86 (Gb/loadState save)) 86 (Gb/loadState save))
87 (println "no backup state")))) 87 (println "no backup state"))))
88 88
89 (defn clear-history [] (reset! history {})) 89 (defn clear-history [] (reset! history {}))
90 90
91 (defn rewind [] (goto (dec @current-frame))) 91 (defn rewind
92 ([n] (goto (- @current-frame n)))
93 ([] (rewind 1)))
92 94
93 (defn backup-state [frame] 95 (defn backup-state [frame]
94 (swap! history #(assoc % frame (save-state)))) 96 (swap! history #(assoc % frame (save-state))))
95 97
96 (def ^:dynamic *save-history* true) 98 (def ^:dynamic *save-history* true)