From 39a25fa7e30183af160e1ecb4b71cb096640c06d Mon Sep 17 00:00:00 2001 From: Erik Rauer Date: Thu, 18 Mar 2021 22:49:44 -0500 Subject: [PATCH] Change the `string/first` instruction This changes the `string/first` instruction to return :ignore-instruction if the string is empty. --- src/propeller/push/instructions/string.cljc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/propeller/push/instructions/string.cljc b/src/propeller/push/instructions/string.cljc index 445373b..f8ddeae 100755 --- a/src/propeller/push/instructions/string.cljc +++ b/src/propeller/push/instructions/string.cljc @@ -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