Course of Raku / Functional, concurrent, reactive, and web programming / Functional programming / Higher-order functions / Exercises
Filter with a block
Problem
grep is a higher-order function: it takes a block and
keeps the elements for which the block is true. Use grep to
count how many numbers in the range 1..10 are greater than
5, and print the count.
Example
The program prints:
5Solution
Course navigation
← Solution: Make a multiplier | Solution: Filter with a block →