 ;   :needs {:integer 2}
 ;   :makes {:integer 1}
 ;   :tags [:arithmetic :core]
-;     (consume :integer :as :int1)
+;     (consume-top-of :integer :as :int1)
 ;     (consume :integer :as :int2)
 ;     (remember-calc [:int1 :int2] %(+ %1 %2) as :sum)
 ;     (place :integer :sum)


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


;; 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]`
;    store the number of items in `stackname` under key `local`
;    raise an Exception if the stack doesn't exist

; + `consume-top-of [stackname]`
;    pop an item (and discard it) from `stackname`
;    raise an Exception if it's empty or undefined

; + `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

