Fork me on GitHub
#specter
<
2018-10-01
>
schmee22:10:44

I have two selects that only differ in the argument to must: (select [ALL ALL (selected? (must x))] board), where x is :color and :robot

schmee22:10:37

any way to combine the two into one or should I just do them separately?

tanzoniteblack22:10:13

if you want to do 1 call that returns both, you could probably do (selected? (multi-path (must :color) (must :robot)))?

tanzoniteblack22:10:15

probably could also do (must (multi-path :color :robot))?

schmee22:10:00

oh sorry, I forgot to mention that I would like to get the results in two different arrays, sort of like this:

user=> (select [(multi-path (filterer odd?) (filterer even?))] (range 10))
[[1 3 5 7 9] [0 2 4 6 8]]

schmee22:10:29

I have a vague recollection that I’ve asked this question before, and that the answer was no 😄

nathanmarz22:10:55

@schmee yea, there's no way to do that

👍 4
nathanmarz22:10:36

besides doing (multi-path (subselect ...) (subselect ...)), but that's no more efficient than just doing two select's

idiomancy22:10:23

hmm. can anyone think of a way to say "every element after the first element" without knowing the length of the sequence in advance? like a rest or drop 1 navigator?

idiomancy22:10:48

hmm, maybe something with not-selected

nathanmarz22:10:12

@idiomancy you can do that with srange-dynamic or INDEXED-VALS

idiomancy22:10:37

gotcha, yeah that makes sense

idiomancy22:10:42

so something like (def REST [(spr/srange-dynamic #(do 1) #(count %)) spr/ALL])

nathanmarz23:10:37

actually (def REST (path (srange-dynamic #(do 1) count) ALL)) is better

nathanmarz23:10:16

more efficient to use when constructing paths dynamically

idiomancy23:10:05

huh, interesting! Thanks for the tip! So, what do you mean by "dynamically" here? Is there some way to construct them at compile time instead?

idiomancy23:10:09

nvm, referring to the documentation now

idiomancy23:10:17

again, thanks!