Change the string/first instruction

This changes the `string/first` instruction to return :ignore-instruction if the string is empty.
This commit is contained in:
Erik Rauer 2021-03-18 22:49:44 -05:00
parent 2008712e0a
commit 39a25fa7e3

View File

@ -68,7 +68,9 @@
:string_first
^{:stacks #{:char :string}}
(fn [state]
(make-instruction state first [:string] :char)))
(make-instruction state
#(if (empty? %) :ignore-instruction (first %))
[:string] :char)))
;; Pushes the STRING version of the top BOOLEAN, e.g. "true"
(def-instruction