list append not working

In the manual, append is listed as a valid nyquist function. Indeed there is no error, but it does not work. For example, try this in your nyquist prompt (debug):

(setq testlist (list (list 0.0 “0”)))
(append testlist (list 1.0 “1”))
(print testlist)

Yes, this is a list of lists, but append does not work even for simple lists.

My goal is to generate a list of labels. I am able to loop through and create the appropriate label values, but cannot append them to my list. Do you have any ideas for how I might do this? Is append actually fine and I’ve missed something?

Thanks for reading and for any assistance you would offer.

The Audacity manual has to cover the whole of Audacity, so it’s far from comprehensive regarding Nyquist.
See here for additional documentation: https://forum.audacityteam.org/t/manuals-and-reference-material/32817/1

For LISP functions, the XLISP 2.0 manual is the best reference: https://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/xlisp/xlisp-index.htm
Re. “APPEND”: https://www.audacity-forum.de/download/edgar/nyquist/nyquist-doc/xlisp/xlisp-ref/xlisp-ref-026.htm

and regarding your code example, try this:

(setq testlist (list (list 0.0 "0")))
(setf testlist (append testlist (list 1.0 "1")))
(format nil "~a" testlist)

Like this:

(setf labels ())  ;an empty list that we will put the labels

;; Some labels to add:
(setf label1 (list 0 0 "First"))
(setf label2 (list 1 1 "second"))
(setf label3 (list 2 3 "region"))

; Push label1 into the list 'labels' 
(push label1 labels)

; Test it (use the Debug button to see this)
(format t "Labels now contains: ~a~%" labels)


; Push label2 into the list 'labels' 
(push label2 labels)

; Test it (use the Debug button to see this)
(format t "Labels now contains: ~a~%" labels)


; Push label2 into the list 'labels' 
(push label3 labels)

; Test it (use the Debug button to see this)
(format t "Labels now contains: ~a~%" labels)


; Return the list of lists to Audacity
; Audacity should create labels from this list of lists.
labels

Thank you so much for your response, the reference manuals, and code examples. Indeed I was using append incorrectly. It looks like I expected to work as push does.