Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!ccu.umanitoba.ca!herald.usask.ca!alberta!aunro!ukma!widener!netnews.upenn.edu!linc.cis.upenn.edu!vinson From: vinson@linc.cis.upenn.edu (Jack Vinson) Newsgroups: comp.lang.lisp Subject: messing with lists Message-ID: <43991@netnews.upenn.edu> Date: 31 May 91 21:23:24 GMT Sender: news@netnews.upenn.edu Reply-To: vinson@linc.cis.upenn.edu (Jack Vinson) Organization: University of Pennsylvania Lines: 36 Nntp-Posting-Host: linc.cis.upenn.edu Hi Folks, again, (can you tell I'm doing a lot of hacking?) I will try to describe my problem by example: Start with (setq my-list '((a b c d e f))) Find out how many sets of data I will be playing with and end up with my list looking like (for five sets of data) ((a b c d e f) (a b c d e f) (a b c d e f) (a b c d e f) (a b c d e f)) I wanted to set up a separate function to do this because there are a couple different lists to which this applies. I tried using this (defun fill-list (n form) (do ((i 1 (1+ i))) ((= i n) form) (setf form (append (list (car form)) form)))) (setf my-list (fill-list 5 my-list)) Which appears to work until I try setf on various elements in the sublists. I guess fill-list retains pointers, cuz when I (setf (nth 3 (car my-list)) 'x) all of the d's get changed rather than just the one in the first sublist. Does this make any sense. I don't know at the start how many copies of the list I will want, otherwise I would just make the initial setq of the correct size. Thanks for help on previous questions and this one and those to come.... Jack Vinson vinson@linc.cis.upenn.edu