Method: LazyList::ModuleFunctions#mix
- Defined in:
- lib/lazylist.rb
#mix(*lists) ⇒ Object
Returns a LazyList, that consists of the mixed elements of the lists _lists without any special order.
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/lazylist.rb', line 250 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 |