Is there some way to say STAY if SUBPATH 1 and SUBPATH 2 match
I cannot find a way to check if two subpaths are both present
to implement collecting an item if prop1 = x and prop2 = y
used multiple selected?
to accomplish that
hi I’m trying to figure out how exactly INDEXED-VALS works. Like the example . For say [0 1 2 3 4]
, I want to move say the 3 at index 3, to say the 0th or some other index. The select is clear to me, basically like map-indexed
. But I’m not quite grokking what’s happening in the setval
example.
This looks like it would do something like set all the indicies to 0. (sp/setval [sp/INDEXED-VALS sp/FIRST] 0 [0 1 2 3 4])
but say (sp/setval [sp/INDEXED-VALS sp/FIRST 2] 0 [0 1 2 3 4])
would move 2 to the front of the list. That’s obviously not how it works lol
it traverses the values in order, so it moves them all to index 0 in order, having the effect of reversing the vector
you can move just one particular value like this:
user=> (setval [INDEXED-VALS (selected? LAST (pred= 3)) FIRST] 0 [0 1 2 3 4])
[3 0 1 2 4]
but index-nav
is better for moving one value at a specific position:
user=> (setval (index-nav 3) 0 [0 1 2 3 4])
[3 0 1 2 4]