Fork me on GitHub
#specter
<
2017-07-30
>
rcullito00:07:33

Hey all, I’m a little confused about how conceptually to think about using filterer versus just containing a predicate in my path. To take this example:

rcullito00:07:38

(select (filterer even?) (range 10))
[[0 2 4 6 8]]

(select [ALL even?] (range 10))
[0 2 4 6 8]

rcullito00:07:02

it is still unclear to me why the filterer version would be nested versus the second example.

drowsy00:07:38

as far as I understand filterer navigates to the subcollection (so you could for example reverse it) while ALL pred navigates to every single number (so you could for example inc it)

nathanmarz00:07:06

@rcullito by navigating you to a sequence you can do things with filterer that you can't do with navigators that go straight to subvalues, e.g. selecting the last even number in a sequence: (select-any [(filterer even?) LAST] (range 10)) ; => 8

rcullito06:07:41

Thanks for the examples: @drowsy, @nathanmarz! Starting to pick up on the subtleties for when it is preferable to use filterer. Much appreciated.