May 2018
Beginner to intermediate
290 pages
6h 43m
English
As convenient as functions like partition and interpose are, the real power of sequences only comes into play when you mix in the functions are values idea. A great example of this is the filter function. You can probably guess from the name what filter does: you pass filter a predicate and a collection, and it gives you back a new sequence populated with only those items from the original sequence that measured up to the predicate. The predicate is, of course, expressed as a function. So if we needed all the negative numbers in a list, we could combine filter with the neg?:
| | ;; Returns the sequence (-22 -99 -77) |
| | |
| | (filter neg? '(1 -22 3 -99 4 5 6 -77)) |
More realistically, if we had this vector of maps: ...
Read now
Unlock full access