 ;    save a list of all active instructions in the named local
 
 ; - `inputs [:as kwd]`
-;    save a list of all known inputs in the namedlocal
+;    save a list of all known inputs in the named local
+
+; - `counter [:as kwd]`
+;    save the current interpreter counter in the named local
 
 
 (def six-ints (make-interpreter :stacks {:integer '(6 5 4 3 2 1)}))
-
-
 
 (defn store-scratch
   "stores a scratch kv pair; convenience function for DSL"


(fact "remember-calc stores the result of a calculation in a named scratch"
  (let [integer-added (-> [six-ints {}]
                          (consume :integer :as :int1)
                          (consume :integer :as :int2)
                          (remember-calc [:int1 :int2] #(+ %1 %2) :as :sum))]
  (second integer-added) => {:int1 6, :int2 5, :sum 11}))


(fact "remember-calc has no effect if :as is not specified"
  (let [integer-added (-> [six-ints {}]
                        (consume :integer :as :int1)
                        (consume :integer :as :int2)
                        (remember-calc [:int1 :int2] #(+ %1 %2)))]
  (second integer-added) => {:int1 6, :int2 5}))



(fact "remember-nth stores the nth item of a named stack"
  (let [integer-munged (-> [six-ints {}]
                          (consume-top-of :integer :as :int1)
                          (consume-top-of :integer :as :int2)
                          (remember-nth :integer :as :third :at 1))]
  (second integer-munged) => {:int1 6, :int2 5, :third 3}))  ;; 4 *3* 2 1

