_filter
Remove non-matching elements of a collection --
Function
Anything -> _filter
(exp) -> The same Type
- Receives
- A List of any sort
- exp
- An expression to apply to the received value, which should produce True or False
- Produces
- The elements of the List for which exp produced True
This function is how you take a List of things, and whittle them down to just the ones you want.
exp should take one element from the received List, and produce a YesNo that says whether to include this Thing.
That gets applied to each element of the List; if exp returns Yes, then it is included, otherwise not.
IMPORTANT: if exp's result is empty for one of the elements, it is considered to be No -- the element
will be left out of the results.
This is one of the most commonly-useful functions in Querki. It is how you usually say, "I only want some
of the elements in this List or Set".