#
# var i = [1,2,3,4,5].iterator
# assert i.head(2).to_a == [1,2]
- # i.to_a == [3,4,5]
+ # assert i.to_a == [3,4,5]
fun head(length: Int): Iterator[E]
do
return new PipeHead[E](self, length)
var source: Iterator[E]
var skip_item: E
- init(source: Iterator[E], skip_item: E)
- do
- self.source = source
- self.skip_item = skip_item
-
- do_skip
- end
+ init do do_skip
fun do_skip
do
var lasts = new List[E]
- init(source: Iterator[E], length: Int)
+ init
do
- self.source = source
- self.length = length
var lasts = self.lasts
while source.is_ok and lasts.length < length do
lasts.push(source.item)
var predicate: Function[E, Bool]
- init(source: Iterator[E], predicate: Function[E, Bool])
- do
- self.source = source
- self.predicate = predicate
-
- do_skip
- end
+ init do do_skip
fun do_skip
do