A visualization of eager and lazy enumeration in Ruby.
https://joyofrails.github.io/ruby-enumeration-demo/
Rubyists love Ruby’s Enumerable
:
1.upto(5).map { |item| item * 2 }.take(3)
# => [2, 4, 6]
But Ruby’s .lazy
enumerator can be confusing:
1.upto(5).lazy.map { |item| item * 2 }.take(3).to_a
# => [2, 4, 6]
What’s going on here?
This visualization may help illustrate the difference.
Make sure node
and npm
is installed. See .node-version
for current version.
Install dependencies:
npm install
Run the Vite dev server:
npm run dev
Build static assets
npm run build