diff --git a/propeller.iml b/propeller.iml
index f20aa6f..6d18148 100644
--- a/propeller.iml
+++ b/propeller.iml
@@ -5,9 +5,9 @@
+
-
diff --git a/src/propeller/push/interpreter.cljc b/src/propeller/push/interpreter.cljc
index 0e01fb2..0735c2e 100755
--- a/src/propeller/push/interpreter.cljc
+++ b/src/propeller/push/interpreter.cljc
@@ -37,10 +37,17 @@
(name instruction))))))))
(defn interpret-program
- "Runs the given problem starting with the stacks in start-state."
+ "Runs the given problem starting with the stacks in start-state. If the
+ start-state includes the key :keep-history with a truthy value, then
+ the returned state will include the key :history with a value that is a
+ vector containing all states prior to the final state."
[program start-state step-limit]
- (loop [state (assoc start-state :exec program :step 1)]
+ (loop [state (assoc start-state :exec program :step 1)
+ history []]
(if (or (empty? (:exec state))
(> (:step state) step-limit))
- state
- (recur (update (interpret-one-step state) :step inc)))))
+ (if (:keep-history state)
+ (assoc state :history history)
+ state)
+ (recur (update (interpret-one-step state) :step inc)
+ (when (:keep-history state) (conj history state))))))
diff --git a/src/propeller/session.cljc b/src/propeller/session.cljc
index c9f9e22..d949528 100755
--- a/src/propeller/session.cljc
+++ b/src/propeller/session.cljc
@@ -10,9 +10,12 @@
[propeller.push.state :as state]
[propeller.push.utils.helpers :refer [get-stack-instructions]]))
-;#_(interpreter/interpret-program
-; '(1 2 :integer_add) state/empty-state 1000)
-;
+#_(interpreter/interpret-program
+ '(1 2 :integer_add) state/empty-state 1000)
+
+#_(interpreter/interpret-program
+ '(1 2 :integer_add) (assoc state/empty-state :keep-history true) 1000)
+
;#_(interpreter/interpret-program
; '(3 3 :integer_eq :exec_if (1 "yes") (2 "no"))
; state/empty-state