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

Miscellaneous Pattern-Matching Examples

Decide what you think process is defined as in the examples below, and then find the answers at the end:

Example 1:

  a = 2; // this definition is not used
  f(a,b) = a+b;  // a is a formal argument that is used
  process = f(3,4); // see below for the answer

Example 2:

  a = 2; // this definition is used (not shadowed by formal arg)
  f(c*b) = a+b;
  process = f(3*4); // see below

Example 3:

  a = 2; // not used - shadowed by pattern variable
  f(a*b) = a+b;
  process = f(3*4);

Answers: 7, 6, 7


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 © 2024-05-01 by Julius O. Smith III
Center for Computer Research in Music and Acoustics (CCRMA),   Stanford University
CCRMA