Extending dolist

Started by Jeremy Dunn, February 04, 2005, 01:20:56 PM

Previous topic - Next topic

Jeremy Dunn

I occasionally run across situations where I want dolist to set more than one variable for more than one list. Suppose we have two lists



L1 (a b c ... n)

L2 (A B C... N)



I would like to be able to write something like



(dolist ('(X Y) L1 L2)

   <dostuff here>

)



where sequentially X would be set to a,b,c... and Y to A,B,C...



I would also like to write



(dolist (X L1 L2)

   <dostuff here>

)



where X would sequentially be set to a series of lists (a A)(b B) ...



Is there some elegant way of doing these that I am unaware of?

eddier

#1
I use map for those occasions.



(map (fn (x y) (whatever with x and y))

 X Y)



eddie