The pattern-matching facility is not applied to ordinary formal
function parameters [5]. In other words,
`f(x,y,z)=expression` is treated as a function having three formal
parameters that are expected to appear literally in `expression`
(*e.g.*, an expression such as `x*y+z`). This interpretation is in
contrast to a function whose input is three parallel block diagrams of
arbitrary generality. As a result of this exception, the mere
*number* of formal parameters does not contribute to the
uniqueness of a pattern. For example, the following program generates
a compile-time error:

f(x,y) = f(x) + f(y); // (x,y) => f(x),f(y):+ f(x) = 2*x; // (x) => 2,x:* process = f(3,5);The compiler-error triggered is ``inconsistent number of parameters in pattern-matching rule: (x) => 2,x:*; previous rule was (x,y) => f(x),f(y):+''. On the other hand, the following program outputs the constant signal 16:

f((x,y)) = f(x) + f(y); f(x) = 2*x; process = f((3,5));The extra parentheses distinguish the pattern

As another example, the following program also outputs the constant signal 16:

f(x*y) = f(x) + f(y); f(x) = 2*x; process = f(3*5);Since the expression

Download aspf.pdf

[Comment on this page via email]

Copyright ©

Center for Computer Research in Music and Acoustics (CCRMA), Stanford University