stepheneb wrote:confused a bit about differences between setq and setf
There's two schools of thought:
1) Always use SETF (it does everything that SETQ does and more)
2) Use SETQ for setting simple numeric values, and use SETF for everything else.
I think that historically SETQ came first. It is just a shorthand way of writing (set (quote variable) value)
The QUOTE function, which may be written as a single quote character, tells Lisp not to evaluate the variable.
These assignments are just different ways of writing the same thing:
Code: Select all
(set (quote my-var 42))
(set 'my-var 42)
(setq my-var 42)
This will throw an error:
Code: Select all
(set my-var 42)
;; error: unbound variable - MY-VAR
The SETF command is more powerful, and will allow other types of assignments, such as setting the value of an element in an array:
Code: Select all
(setf ar (make-array 3))
(setf (aref ar 1) "My String Value")
(print ar) ;returns "My String Value"
Which prints to the debug window:
We could use (setq ar (make-array 3))
but (setq (aref ar 1) "My String Value) will fail because (aref ar index) is a function and not a simple "symbol".
SETQ can only be used with symbols (simple variables).
For looking up things about XLISP, the XLISP manual is more detailed than the Nyquist manual, and provides examples for most functions.
The XLISP manual is here:
http://www.audacity-forum.de/download/e ... -index.htm
Regarding the bigger question, I'll need to spend some time with your code, which I don't have time to do right now.
Can you narrow down the problem by writing short test scripts for each of your functions?