This is my first post so I apologize if I'm too vague or haven't done this correctly!
So I have an empty list L1 and two variables x and y which can be anything.
Say for example x = 10 and y = 20.
I would like the list L1 to start with x, and then I have a WHEN loop that add's y to the list every time it loops but I can't seem to get the list in the format I would like.
I currently have:
(let ((L1 x))) ; Adds x to the list
(loop
(when (> n 10) (return)) ; While n < 10, add's y to the list.
(setq L1 (list L1 y))
(incf n)))
Which returns:
(10 20)
((10 20) 20)
(((10 20) 20) 20)
((((10 20) 20) 20) 20)
(((((10 20) 20) 20) 20) 20) ...
However I would like it to return:
( (10) (20) )
( (10) (20) (20) )
( (10) (20) (20) (20) )
( (10) (20) (20) (20) (20) )
( (10) (20) (20) (20) (20) (20) ) ...
Any ideas how I could do this?
Any help would be much appreciated!