Next  |  Prev  |  Up  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Pattern-Matching Example

Does the pattern (a:b) match (2+3)? Yes, as we will see below.8

Rewriting 2+3 in BDNF gives ((2,3):+). Expressing this in Lisp form gives

    2+3 -> ((2,3):+) -> (: (, 2 3) (+))
The arguments to the function `:' are the expressions `(, 2 3)' and `(+)'. The arguments to the function `,' are `2' and `3'.

Rewriting the pattern (a:b) in Lisp form gives

    (a:b) -> (: a b)

Since both patterns are of the form (: a b), the patterns match.


Next  |  Prev  |  Up  |  Top  |  JOS Index  |  JOS Pubs  |  JOS Home  |  Search

Download aspf.pdf
[Comment on this page via email]

``Audio Signal Processing in Faust'', by Julius O. Smith III.
Copyright © 2022-05-05 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA