This module contains module functions, that are added to LazyList and it’s instances.
Delay the value of block to a Promise.
# File lib/lazylist.rb, line 58 def delay(&block) MemoPromise.new(&block) end
Force the delayed obj to evaluate to its value.
# File lib/lazylist.rb, line 63 def force(obj) case obj when Promise force obj.__value__ else obj end end
Returns a LazyList, that consists of the mixed elements of the lists _lists without any special order.
# File lib/lazylist.rb, line 74 def mix(*lists) return empty if lists.empty? first = lists.shift if lists.empty? first elsif first.empty? mix(*lists) else LazyList.new(first.head) do t = first.tail lists = lists.push t unless t.empty? mix(*lists) end end end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.