Pwhile : FuncFilterPattern : FilterPattern : Pattern : AbstractFunction : Object

While a condition holds, repeatedly embed stream

Description

Repeatedly embed a Stream while the result of func is true.

Class Methods

Pwhile.new(func, pattern)

From superclass: FuncFilterPattern

Arguments:

func

Stream function. In an event stream receives the current Event as argument.

pattern

A Pattern.

Inherited class methods

Instance Methods

Inherited instance methods

Undocumented instance methods

.embedInStream(event)

Examples

(
z = true;
a = Pwhile({ z }, Pseq(#[1, 2, 3]));
x = a.asStream;
);

7.do({ x.next.postln; }); // while z == true, the values are embedded
z = false; // set z to false
x.next; // the rest of the stream is still embedded
x.next;
x.next; // but then it is not continued.
x.next;
x.next;
x.next;