How Lazy Evaluation Works in Ruby

How Lazy Evaluation Works in Ruby

Dec 02, 2021

During our day-to-day work, we as developers quite often have to deal with big data or — sometimes — data of unknown size. We parse big files and import the stuff we need, we are scraping some data from various websites in search of something, or we are just working with some big data from our own database to transform it and do something with it.

To do so efficiently we have many options to fall back to. Ruby, like most languages, gives us a lot of options to handle such situations. When working with files we can read them line by line, we can divide the data into smaller chunks with the help of self-written methods and passing around blocks. But, we have another option as well, that isn’t so often used: lazy enumeration.

Read the full story here

Enjoy this post?

Buy Gernot Gradwohl a coffee

More from Gernot Gradwohl