[Audacity-nyquist] Re: Probably a simple question about list variables (fwd)
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
|
From: David R. S. <sk...@wa...> - 2004-11-22 12:19:10
|
I posted my list question on comp.lang.lisp and got the answer I was looking
for... which looks something like what you suggested Steve! Hope others find
this useful. David
--
---------- Forwarded message ----------
Date: 22 Nov 2004 12:07:48 +0100
From: Pascal Bourguignon <
Newsgroups: comp.lang.lisp
Subject: Re: Probably a simple question about list variables
"David R. Sky" <
> I've been learning XLisp via Nyquist, and have been stuck on lists
> in the following way:
>
> The user defines 16 pairs of variables (numerically), and I've put
> them in a list:
>
> (setf mylist '(a1 b1 a2 b2 a3 b3 ... a16 b16))
>
> and using a looping function, trying to get the numeric values
> passed to a and b for a defun:
>
> (dotimes (i count)
> (setf a (nth (* i 2) mylist))
> (setf b (nth (+ 1 (* i 2)) mylist)))
>
> What is 'passed' to a and b is not the numeric value, but the
> alphanumeric values a1 b1 etc.
>
> I've been googling extensively and looking in Nyquist, XLisp and
> Lisp manuals, to no avail. I have a hunch it's something simple -
> what is it please?
if a1, ... b16 are _variables_ you should build the list as:
(setf mylist (list a1 b1 a2 b2 a3 b3 ... a16 b16))
instead of using a literal list of _symbols_ (not alphanumeric values!).
--
__Pascal Bourguignon__ http://www.informatimago.com/
The world will now reboot; don't bother saving your artefacts.
|