I'm working on a program that takes a list of elements and each individual element is duplicated based on an integer contained in a 2nd list of integers. for example if I had a list of
(A B C D)
being duplicated by:
(1 5 4 2)
I would have
(A B B B B B C C C C D D)
So far I have
(defun COPY (X Y)
(if (zerop Y)
nil
(cons S (COPY X (1 - Y)))))
Of course this is only duplicating a single element a single number of times. Does anybody have a good idea how to go about this?