[CM] query on references within Loop

Rick Taube taube@uiuc.edu
Tue, 15 Aug 2006 07:40:35 -0500


adam, the program should look like this.

(define a-ref '(a1  (1 2 3)  a2))
(define b-ref '(b1  (4 5 6)  b2))
(define c-ref '(c1  (7 8 9)  c2))

(define ref-list (list a-ref b-ref c-ref))

(loop for refx in ref-list
       collect
       (loop for data in (second refx)
	    collect data))
;--

but note that your inner loop is returing exactly what (second refx)  
returns and so the whole loop could be written

(loop for refx in ref-list
       collect (second refx))

--rick

>
> This has me a little puzzled, in Common Music,
>
> The intention is that Loop cycles through a list, and for each  
> entry then
> collects a list carried in that item.
>
> However an error reports that ..  a-ref  is not of type list.   
> While it
> appears to be a list, perhaps its outside of the Loop scope somehow ?
>
> Can anyone suggest where I am going wrong here ?
>
> (define a-ref '('a1  (1 2 3)  'a2))
> (define b-ref '('b1  (4 5 6)  'b2))
> (define c-ref '('c1  (7 8 9)  'c2))
>
> (define ref-list '(a-ref b-ref c-ref))
>
> (loop for refx in ref-list
>       collect
>       (loop for data in (second refx)
> 	    collect data))
>
>
> _______________________________________________
> Cmdist mailing list
> Cmdist@ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/cmdist