[CM] one-over-f-noise
Fernando Pablo Lopez-Lezcano
nando@ccrma.Stanford.EDU
11 Nov 2002 09:45:02 -0800
> I've been looking at an old example that I found online, the
> one-over-f-noise.lsp function (or pair of functions). There is a part I
> don't understand in the let* form (if that's the right word) of the
> second function. Here's the listing:
>
>
> (defun one-over-f-noise (power-of-2)
> (let* (rtn
> (length (expt 2 power-of-2))
> (half-range (/ 1.0 power-of-2))
> (r (make-array (list power-of-2)))) ; bug: should free array
> (loop for n from 0 to (- length 1) do
> (push
> (one-over-f-aux n power-of-2 r half-range)
> rtn))
> rtn))
>
> I'll append the whole program below (necessary if you want to try it at
> home).
"rtn" is just a "local variable" declared in the let, it has no initial
value so that defaults to nil. It is used inside the loop to build up a
list (the "push" function does that). The value of rtn is what is
returned from the function. The last form ("rtn") evaluates to the
contents of "rtn" and that is what is returned.
-- Fernando