From 9cd4f875c2dbe91c216285b088cb11dfa331bf70 Mon Sep 17 00:00:00 2001 From: Erik Rauer Date: Sun, 21 Mar 2021 01:02:11 -0500 Subject: [PATCH] Fix `string/indexof-char` Changes `string/indexof-char` to return :ignore-instruction if the character is not present in the string. This makes it consistent with it's description --- src/propeller/push/instructions/string.cljc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/propeller/push/instructions/string.cljc b/src/propeller/push/instructions/string.cljc index f8ddeae..46d9811 100755 --- a/src/propeller/push/instructions/string.cljc +++ b/src/propeller/push/instructions/string.cljc @@ -106,7 +106,11 @@ :string_indexof_char ^{:stacks #{:char :integer :string}} (fn [state] - (make-instruction state string/index-of [:string :char] :integer))) + (make-instruction state + #(let [index (string/index-of %1 %2)] + (if index index :ignore-instruction)) + [:string :char] + :integer))) ;; Iterates over the top STRING using code on the EXEC stack (def-instruction