 ;; Everything would be assumed to happen inside one interpreter, and the interpreter
 ;; (and some store of scratch vars) would be passed step-to-step.
 ;;
-; - `count-of [stackname :as local]`
+; + `count-of [stackname :as local]`
 ;    store the number of items in `stackname` under key `local`
 ;    raise an Exception if the stack doesn't exist
 
-; + `consume [stackname]`
+; + `consume-top-of [stackname]`
 ;    pop an item (and discard it) from `stackname`
 ;    raise an Exception if it's empty or undefined
 
-; + `consume [stackname :as local]`
+; + `consume-top-of [stackname :as local]`
 ;    pop an item from `stackname` and store under key `local`
 ;    raise an Exception if it's empty or undefined
 


(fact "remember-stack stores the stack specified in the :as variable"
  (let [integer-munged (-> [six-ints {}]
                          (consume :integer :as :int1)
                          (consume :integer :as :int2)
                          (remember-stack :integer :as :rest))]
  (second integer-munged) => {:int1 6, :int2 5, :rest '(4 3 2 1)}))


(fact "remember-stack has no effect if :as is not specified"
  (let [integer-munged (-> [six-ints {}]
                        (consume :integer :as :int1)
                        (consume :integer :as :int2)
                        (remember-stack :integer))]
  (second integer-munged) => {: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

