 (ns clojush.instructions.return
   (:use [clojush.pushstate]))
-
 
 (defn returner
   "Returns a function that takes a state and moves the top literal

      (let [top-env (top-item :environment state)
            new-env (assoc top-env :tag (:tag state))]
        (push-item new-env :environment (pop-item :environment state))))))

  return_exec_pop
  ^{:stack-types [:environment :exec]}
  (fn [state]
    (assoc state :return (list-concat (:return state)
                                      (list 'exec_pop)))))

(define-registered
  return_code_pop
  ^{:stack-types [:environment :code]}
  (fn [state]
    (assoc state :return (list-concat (:return state)
                                      (list 'code_pop)))))

(define-registered
  return_integer_pop
  ^{:stack-types [:environment :integer]}
  (fn [state]
    (assoc state :return (list-concat (:return state)
                                      (list 'integer_pop)))))

(define-registered
  return_float_pop
  ^{:stack-types [:environment :float]}
  (fn [state]
    (assoc state :return (list-concat (:return state)
                                      (list 'float_pop)))))

(define-registered
  return_boolean_pop
  ^{:stack-types [:environment :boolean]}
  (fn [state]
    (assoc state :return (list-concat (:return state)
                                      (list 'boolean_pop)))))

(define-registered
  return_zip_pop
  ^{:stack-types [:environment :zip]}
  (fn [state]
    (assoc state :return (list-concat (:return state)
                                      (list 'zip_pop)))))

(define-registered
  return_string_pop
  ^{:stack-types [:environment :string]}
  (fn [state]
    (assoc state :return (list-concat (:return state)
                                      (list 'string_pop)))))

(define-registered
  return_char_pop
  ^{:stack-types [:environment :char]}
  (fn [state]
    (assoc state :return (list-concat (:return state)
                                      (list 'char_pop)))))

; Immediately copies the current tagspace to the environment on the top
; of the :environment stack.
