specter

Latest version: 1.1.3
schmee 2018-10-01T22:03:44.000100Z

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

schmee 2018-10-01T22:04:37.000100Z

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

tanzoniteblack 2018-10-01T22:15:13.000100Z

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

tanzoniteblack 2018-10-01T22:17:15.000100Z

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

schmee 2018-10-01T22:20:00.000100Z

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]]

schmee 2018-10-01T22:22:29.000100Z

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

nathanmarz 2018-10-01T22:36:55.000100Z

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

👍 1
nathanmarz 2018-10-01T22:37:36.000100Z

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

idiomancy 2018-10-01T22:46:23.000200Z

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?

idiomancy 2018-10-01T22:48:48.000100Z

hmm, maybe something with not-selected

nathanmarz 2018-10-01T22:57:12.000100Z

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

idiomancy 2018-10-01T22:57:37.000100Z

gotcha, yeah that makes sense

idiomancy 2018-10-01T22:59:42.000100Z

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

nathanmarz 2018-10-01T23:27:53.000100Z

@idiomancy yes

👍 1
nathanmarz 2018-10-01T23:28:37.000100Z

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

nathanmarz 2018-10-01T23:29:16.000200Z

more efficient to use when constructing paths dynamically

idiomancy 2018-10-01T23:30:05.000100Z

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?

idiomancy 2018-10-01T23:32:09.000100Z

nvm, referring to the documentation now

idiomancy 2018-10-01T23:32:17.000100Z

again, thanks!