FilterSeq - laforge49/Asynchronous-Functional-Programming GitHub Wiki

FilterSeq[K, V] is a subclass of Sequence[K, V] and creates a sequence from selected values of another sequence. The constructor takes two parameters, (1) another sequence actor, seq: Sequence[K, V], and (2) a function, f: V => Boolean. FilterSeq takes its mailbox from its seq actor, so its interactions with seq are usually synchronous.

Test code.

val range = new Range(0, 4)
val filter = new FilterSeq(range, (v: Int) => v % 2 == 0)
Future(filter, Loop((key: Int, value: Int) => println(key+" "+value)))

Output.

0 0
2 2

FilterSeqTest

Tutorial