Harlowe's documentation tells us to use (move:) or (subarray:) to remove an element from an array. But both macros work with indexes:
(set: $a to (array: "one", "two"))
(set: $b to (array:))
(move: $a's 1st to $b)
This approach doesn't work for me because I don't know the array position of the value I want to remove. What I want is to remove a value, not a position.
I need a way of removing the value "one" from any possible array containing "one" in any position (for example, both arrays ("one","two") and ("two","one")), and the only input I can provide is the value "one" itself.
Another problem is that (move:) leaves a blank value instead of the removed value. Is there a way to completely remove it, so the array becomes one value shorter?
Current result: ("one","two") -> ("","two")
Desired result: ("one","two") -> ("two")
Is there anything I can do? Thanks!
Comments
BTW In your first example you've got (move: $a's 1st to $b) which will just set the first item of $a to 0. Doing (move: $a's 1st into $b) ,or for a datamap (move: $a's 1 into $b), will remove that item completely.