Fix vector/_replacefirst
This changes the function to throw `:ignore-instruction` if the replacement value is not present in the vector.
This commit is contained in:
parent
bcddca184c
commit
d5f115f81c
@ -183,7 +183,10 @@
|
|||||||
(let [lit-stack (get-vector-literal-type stack)]
|
(let [lit-stack (get-vector-literal-type stack)]
|
||||||
(make-instruction state
|
(make-instruction state
|
||||||
(fn [lit1 lit2 vect]
|
(fn [lit1 lit2 vect]
|
||||||
(assoc vect (utils/indexof lit1 vect) lit2))
|
(let [replaceindex (utils/indexof lit1 vect)]
|
||||||
|
(if (= replaceindex -1)
|
||||||
|
:ignore-instruction
|
||||||
|
(assoc vect replaceindex lit2))))
|
||||||
[lit-stack lit-stack stack]
|
[lit-stack lit-stack stack]
|
||||||
stack))))
|
stack))))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user