DEV Community

Loops in Raku and when to use them

Juan Julián Merelo Guervós on April 20, 2019

Sooner or later you need to keep some state between an element and the next, generate some side effect, work with several data structures or, in ...
Collapse
 
epsi profile image
E.R. Nurwijayadi

Good article. Thank you for posting.

This Raku approach remind me of generator/yield pattern.

I'm a beginner in Raku. To help more beginner, I have made a working example of this gather take pattern. And then continue to concurrency with channel.

🕷 epsi.bitbucket.io/lambda/2021/03/0...

First the data structure

Data Structure: Songs Records in List of Hashes

Then we can bundle the gather-take in a producer function. Raku takes short code to solve this unique challenge.

Gather and Take

I hope this could help other who seeks for other case example.

🙏🏽

Thank you for posting with general introduction.

Collapse
 
jj profile image
Juan Julián Merelo Guervós

Amazing! Thanks a lot.

Collapse
 
kirklewis profile image
Kirk Lewis

Cheers for sharing Juan, this is definitely worth knowing.
Perl 6 continues to surprise me :)