Fix handling of boolean input values
This commit is contained in:
parent
7a16770cb9
commit
aed8eb8a76
@ -12,16 +12,16 @@
|
|||||||
;; =============================================================================
|
;; =============================================================================
|
||||||
|
|
||||||
;; Allows Push to handle input instructions of the form :inN, e.g. :in2, taking
|
;; Allows Push to handle input instructions of the form :inN, e.g. :in2, taking
|
||||||
;; elements thus labeled from the :input stack and pushing them onto the :exec
|
;; elements thus labeled from the :input map and pushing them onto the :exec
|
||||||
;; stack. We can tell whether a particular inN instruction is valid if N-1
|
;; stack.
|
||||||
;; values are on the input stack.
|
|
||||||
(defn handle-input-instruction
|
(defn handle-input-instruction
|
||||||
[state instruction]
|
[state instruction]
|
||||||
(if-let [input (instruction (:input state))]
|
(if (contains? (:input state) instruction)
|
||||||
(state/push-to-stack state :exec input)
|
(let [input (instruction (:input state))]
|
||||||
(throw #?(:clj (Exception. (str "Undefined input instruction " instruction))
|
(state/push-to-stack state :exec input))
|
||||||
|
(throw #?(:clj (Exception. (str "Undefined instruction " instruction))
|
||||||
:cljs (js/Error
|
:cljs (js/Error
|
||||||
(str "Undefined input instruction " instruction))))))
|
(str "Undefined instruction " instruction))))))
|
||||||
|
|
||||||
;; =============================================================================
|
;; =============================================================================
|
||||||
;; OUTPUT Instructions
|
;; OUTPUT Instructions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user