Pcollect:
Filter:
Classes | Streams-Patterns-Events > Patterns > Filter

Pcollect : FuncFilterPattern : FilterPattern : Pattern : AbstractFunction : Object

Apply a function to a pattern

Description

Modifies each value by passing it to the function. This is the pattern library's equivalent of Collection: -collect.

Class Methods

Pcollect.new(func, pattern)

From superclass: FuncFilterPattern

Arguments:

func

A Function. Receives values from pattern.

pattern

A Pattern.

Inherited class methods

Instance Methods

Inherited instance methods

Undocumented instance methods

.asStream

.embedInStream(inval)

Examples

The message collect returns a Pcollect when passed to a pattern. Note that because the pattern is converted to a Stream (more precisely a FuncStream) the collect function is evaluated for one item each time the message next is passed.