Module: Lab42::Stream::Utility
- Included in:
- Lab42::Stream
- Defined in:
- lib/lab42/stream/utility.rb
Instance Method Summary collapse
Instance Method Details
#__segment__(beh) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/lab42/stream/utility.rb', line 9 def __segment__ beh if beh.( head ) cons_stream( cons_stream( head ){ tail.lazy_take_until beh } ){ tail.drop_until( beh ).__segment__ beh } else cons_stream( lazy_take_until beh ){ tail.drop_until( beh ).__segment__ beh } end end |
#segment(*args, &blk) ⇒ Object
5 6 7 |
# File 'lib/lab42/stream/utility.rb', line 5 def segment *args, &blk __segment__ blk.make_behavior( *args ) end |
#with_index(start = 0) ⇒ Object
21 22 23 |
# File 'lib/lab42/stream/utility.rb', line 21 def with_index start=0 zip_as_ary iterate( start, :succ ) end |