2 summary:: Apply a function to a pattern
3 categories:: Streams-Patterns-Events>Patterns>Filter
4 related:: Classes/Pselect, Classes/Preject
7 Modifies each value by passing it to the function.
14 A link::Classes/Function::. Receives values from code::pattern::.
16 A link::Classes/Pattern::.
23 a = Pcollect({ arg item; item * 3 }, Pseq(#[1, 2, 3],inf));
25 9.do({ x.next.postln; });
29 The message code::collect:: returns a Pcollect when passed to a pattern. Note that because the pattern is converted to a link::Classes/Stream:: (more precisely a link::Classes/FuncStream::) the collect function is evaluated for one item each time the message code::next:: is passed.
33 a = Pseq(#[1, 2, 3],inf).collect({ arg item; item * 3 });
36 9.do({ x.next.postln; });