each item from it.
functional :: FlatMapIter :: _f
functional :: FlatMapIter :: _inner
functional :: FlatMapIter :: defaultinit
functional :: FlatMapIter :: f
functional :: FlatMapIter :: f=
functional :: FlatMapIter :: inner
functional :: FlatMapIter :: inner=
functional :: FlatMapIter :: try_compute_inner
Tries to resolve the inner iterator.functional $ FlatMapIter :: SELF
Type of this instance, automatically specialized in every classfunctional $ FlatMapIter :: init
functional :: FlatMapIter :: _f
functional :: FlatMapIter :: _inner
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
functional :: FlatMapIter :: defaultinit
core :: Iterator :: defaultinit
core :: Object :: defaultinit
functional :: FunIter :: defaultinit
functional :: FlatMapIter :: f
functional :: FlatMapIter :: f=
functional :: FlatMapIter :: inner
functional :: FlatMapIter :: inner=
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.Iterator
whose elements are sorted by the function
core :: Object :: output_class_name
Display class name on stdout (debug only).functional :: FlatMapIter :: try_compute_inner
Tries to resolve the inner iterator.
# An iterator that maps each item to an iterator and yield
# each item from it.
class FlatMapIter[A,B]
super FunIter[A,B]
var f: Fun1[A, Iterator[B]]
protected var inner: nullable Iterator[B] = null
redef init
do
try_compute_inner
end
redef fun item
do
return inner.as(not null).item
end
redef fun is_ok
do
return inner != null
end
redef fun next
do
inner.next
if not inner.is_ok then
super
try_compute_inner
end
end
# Tries to resolve the inner iterator.
# Assigns null to `inner` if it fails.
protected fun try_compute_inner
do
inner = null
if not my_iter.is_ok then return
var res = f.call(my_iter.item)
if res.is_ok then inner = res
end
end
lib/functional/iter_extras.nit:310,1--350,3