method from-loop

Documentation for method from-loop assembled from the following types:

class Seq

From Seq

(Seq) method from-loop

multi method from-loop(&body:$label)
multi method from-loop(&body&cond:$repeat!:$label)
multi method from-loop(&body&cond:$label)
multi method from-loop(&body&cond&afterwards:$label)

These methods create new Seq-based callbacks.

In general, it produces an infinite Seq by calling &body each time a new element is requested, using the return value from &body as the item. This emulates (or implements) a loop { body } construct.

When the multi includes &cond, it's invoked before each call to &body, and terminates the sequence if &cond returns a false value. If $repeat is set to a true value, the first call to &cond is omitted, and &body called right away. This emulates (or implements) while cond { body } and repeat { body } while cond loops.

If present, &afterward will be called after each call to &body.