 
 
 (defn delete-top-of
-  "Takes an PushDSL blob and a stackname (keyword); deletes the top
-  item of that stack."
+  "Takes an PushDSL blob and a stackname (keyword); deletes the top item of that stack."
   [[interpreter scratch] stackname]
   (let [old-stack (u/get-stack interpreter stackname)
         top-item  (first old-stack)]



(defn consume-nth-of
  "Takes a PushDSL blob, a stackname (keyword), an index argument (an
  integer or a keyword), and a scratch key (also a keyword), copies
  the indicated item from that stack into the scratch variable, and
  deletes it from the stack.

  Exceptions when:
  - the stack doesn't exist
  - the stack is empty
  - no :as argument is present
  - no :at argument is present
  - the :at argument is not a keyword or integer
  - the scratch value passed as a reference is not an integer"
  [[interpreter scratch] stackname & {:keys [as at]}]
  (let [[idx old-stack]
          (get-nth-of [interpreter scratch] stackname :at at)]



(defn save-top-of
  "Takes a PushDSL blob, a stackname (keyword) and a scratch key (also keyword), and copies the top item from that stack into the scratch variable (without deleting it). Exceptions when: no :as argument is present, the stack is empty"
  [[interpreter scratch] stackname & {:keys [as]}]
  (let [old-stack (u/get-stack interpreter stackname)]
    (cond (empty? old-stack) (oops/throw-empty-stack-exception stackname)
