/** * A simple FIR actor. It assumes the presence of the following functions: * * [T] zero : [--> T] * [T] plus : [T, T --> T] * [T] multiply : [T, T --> T] * [T1, T2] collect : [T1, [T1, T2 --> T1], List[T2] --> T1] * [T1, T2, T3] combine : [[T1, T2 --> T3], List[T1], List[T2] --> List[T3]] * * @author JWJ */ actor SimpleFIR [T < Group[T]] (List[T] taps) // the taps are the coefficients, starting // with the one for the most recent data item T input ==> T output : List[T] data := [zero() : for Integer i in Integers(1, #taps)]; action [a] ==> [b] var T b := collect(zero(), plus, combine(multiply, taps, data)) do data := [a] + [data[i] : for Integer i in Integers(0, #taps-2)]; endaction endactor