|
Module IteratorThis module is undocumented. This is a list of its definitions. filter :: (a -> <b> Boolean) -> Iterator.T a -> <Proc,b> () Removes from the underlying collection all remaining values of the iterator that do not satisfy the given predicate. Despite the name this is not The underlying collection must support removal, so an SCL list cannot be filtered this way. Example:
The values are sorted only for printing: the iteration order of an fold :: (a -> b -> <c> a) -> a -> Iterator.T b -> <Proc,c> a Folds over the remaining values of the iterator starting with the given initial value. hasNext :: Iterator.T a -> <Proc> Boolean Returns iter :: (a -> <c> b) -> Iterator.T a -> <Proc,c> () Calls the given function with all remaining values of the iterator. iterB :: (a -> <b> Boolean) -> Iterator.T a -> <Proc,b> Boolean Calls the given function with the remaining values of the iterator until it
returns The result means "was not interrupted", not "found something": it is iterI :: (Integer -> a -> <c> b) -> Iterator.T a -> <Proc,c> () Calls the given function with all remaining values of the iterator, giving also a running index as the first parameter. iterator :: Iterable a -> <Proc> Iterator.T a A new iterator over the values of the given iterable. Example:
An SCL list is a Java mapFirst :: (a -> <c> Maybe b) -> Iterator.T a -> <Proc,c> Maybe b Applies the given function to the remaining values of the iterator until it
returns It is a search and a map in one, and it consumes the iterator only up to and
including the value it accepted, so the rest of the iterator can still be read
afterwards. Example:
The last command folds what is left of the iterator, which is only the value 4:
next :: Iterator.T a -> <Proc> a Advances the iterator and returns the next value. Fails if the iterator has no more values. remove :: Iterator.T a -> <Proc> () Removes from the underlying collection the value that was returned by the
last call of The value to remove is not a parameter: Example:
|