next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Macaulay2Doc :: apply(Thing,Function)

apply(Thing,Function) -- apply a function to an object with an iterator



Suppose x is an instance of a class with the iterator method installed and suppose iter is the output of iterator x. Then a new Iterator object is returned whose next method returns f next iter until next iter returns StopIteration, in which case this new iterator does the same.

i1 : applyiter = apply(iterator "foo", toUpper)

o1 = iterator iterator "foo"

o1 : Iterator
i2 : next applyiter

o2 = F
i3 : next applyiter

o3 = O
i4 : next applyiter

o4 = O
i5 : next applyiter

o5 = StopIteration

o5 : Symbol

See also

Ways to use this method: