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
This commit is contained in:
parent
92cdfe9e59
commit
9cd4f875c2
@ -106,7 +106,11 @@
|
|||||||
:string_indexof_char
|
:string_indexof_char
|
||||||
^{:stacks #{:char :integer :string}}
|
^{:stacks #{:char :integer :string}}
|
||||||
(fn [state]
|
(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
|
;; Iterates over the top STRING using code on the EXEC stack
|
||||||
(def-instruction
|
(def-instruction
|
||||||
|
Loading…
x
Reference in New Issue
Block a user