var i = [1,2,3].iterator
assert fun_to_s.map(i).to_a == ["1", "2", "3"]
Note: because there is no generic method in Nit (yet?),
there is no way to have a better API.
eg. with the Iterator as receiver and the function as argument.
(see Iterator::select
)
# Filter: produce an iterator which each element is transformed.
#
# var i = [1,2,3].iterator
# assert fun_to_s.map(i).to_a == ["1", "2", "3"]
#
# Note: because there is no generic method in Nit (yet?),
# there is no way to have a better API.
# eg. with the Iterator as receiver and the function as argument.
# (see `Iterator::select`)
fun map(i: Iterator[FROM]): Iterator[TO]
do
return new PipeMap[FROM, TO](i, self)
end
lib/pipeline/pipeline.nit:312,2--324,4