[CM] defvar global list

James Hearon j_hearon at hotmail.com
Sun Dec 28 19:42:40 PST 2014

Thank you folks for the hints.  I think I may have it working now using setf.

(defun random-element (list)
  (nth (random (length list)) list))

(defvar mylist '(0.5  100.0  200.25  4000.0 1.0  0.33 0.1 0.2 5000.0 2.0))

(defvar *test* '(nil))  ;global list

   for i from 0 to 9  by 1
        for xx in mylist collect (random-element mylist) into atest ;collect into local list
    finally  (setf *test* atest) ;setf local list to global one

   for i from 0 to 9  by 1
     for xx in *test*  ;access global list
     (format t " ~A" xx)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ccrma-mail.stanford.edu/mailman/private/cmdist/attachments/20141229/cee3596e/attachment.html 

More information about the Cmdist mailing list