Skip to content

@BFalkner /Lazy.rb
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
> LazyEnumerator.new([1, 2, 3]).
map{|el| puts "add #{el}"; el + 1}.
map{|el| puts "mul #{el}"; el * 2}.
each{|el| puts el}
add 1
mul 2
4
add 2
mul 3
6
add 3
mul 4
8
=> #<FunTree::LazyEnumerator:0x100377520 @transformation=#<Proc:0x0000000100119cb0@./lazy_enumerator.rb:15>, @enumerable=#<FunTree::LazyEnumerator:0x100377778 @transformation=#<Proc:0x0000000100119cb0@./lazy_enumerator.rb:15>, @enumerable=#<FunTree::LazyEnumerator:0x100377b88 @transformation=#<Proc:0x000000010011d770@./lazy_enumerator.rb:6>, @enumerable=[1, 2, 3]>>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.