Course of Raku / Functional, concurrent, reactive, and web programming / Concurrent programming / Hyper and race 🆕 / Exercises / A hyper map
Solution: A hyper map
Here is a possible solution to the task.
Code
say <apple banana pear cherry>.hyper.map(*.uc).grep(*.chars > 4).join(' ');🦋 You can find the source code in the file hyper-map.raku.
Output
APPLE BANANA CHERRYComments
.hyperruns the whole chain — themapthat upper-cases and thegrepthat filters by length — across threads, in parallel.Because
.hyperpreserves order, the surviving words stay in their original sequence, so.join(' ')producesAPPLE BANANA CHERRY.pear, with only four letters, is dropped.
Course navigation
← A hyper map | A racing sum →