Music 220b: Winter 2001
Fernando Lopez-Lezcano, instructor
Christopher Burns, teaching assistant
Tamara Smyth, teaching assistant

Week 2: logic - (if) and (cond)

We often want our lisp programs to make decisions. For instance, we might generate (with-sound) calls using a list of frequencies, and use different instruments depending upon the frequency. Or, we might analyze a soundfile, and take different actions depending upon the maximum amplitudes in a particular region.

In order to do these kinds of things, we need logical tests. Lisp provides two commands for this purpose: (if) and (cond).

So far we've only seen the simplest applications of if and cond; but they are the building blocks of far more complicated programs. Let your imagination run wild....

Course resources main page
220b main page