 
 (fact "`place` will push the saved scratch value to the indicated stack in the interpreter"
   (let [integer-added (-> [six-ints {}]
-                          (consume :integer :as :int1)
-                          (consume :integer :as :int2)
+                          (consume-top-of :integer :as :int1)
+                          (consume-top-of :integer :as :int2)
                           (place :boolean :int1))]      
     (get-stack-from-dslblob integer-added :boolean) => '(6)))
 

    (second (store-scratch foo :foo 999)) => {:foo 999}))


(defn consume
  [[interpreter scratch] stack & {:keys [as]}]
  (let [old-stack (get-stack interpreter stack)]
    (cond (empty? old-stack)

  (get-stack interpreter stackname))


(fact "consume-top-of"
  (second (consume-top-of [six-ints {}] :integer :as :int1)) => {:int1 6}
  (get-stack-from-dslblob
    (consume-top-of [six-ints {}] :integer :as :int1)
    :integer) => '(5 4 3 2 1))


(fact "consume-top-of throws an exception if the stack is empty"
  (consume-top-of [six-ints {}] :boolean :as :nope) => (throws #"Push DSL Error:"))


(fact "consume-top-of can be thread-firsted"
  (let [two-popped (->  [six-ints {}]
                        (consume-top-of :integer :as :int1)
                        (consume-top-of :integer :as :int2))]
    (second two-popped) => {:int1 6, :int2 5}
    (get-stack-from-dslblob two-popped :integer) => '(4 3 2 1)))


(fact "consume-top-of with no :as argument just throws the thing away"
  (let [two-popped (->  [six-ints {}]
                        (consume-top-of :integer)
                        (consume-top-of :integer :as :int2))]
    (second two-popped) => {:int2 5}
    (get-stack-from-dslblob two-popped :integer) => '(4 3 2 1)))

