Write a function that takes a list of pairs and classifies them as valid or invalid. Pairs are valid if the age is over 35 and the signature is true.
- We destructure each
signed?pair. Such destructuring is a normal occurrence.
- We return a lazy sequence via
map. We could do something like “get the first three ‘Valid’” and the calculations would stop as soon as we found them.
This is clearly a tutorial type problem, but I suggest getting into the habit of using more descriptive data structures:
I’m partially anticipating that this function will be part of a larger data-flow, so the return is transformed data instead of just the
valid? data apart from the context.
Find this post useful? Share the love! Tweet