Write a tail recursive function called replicate-to-length, which in a cyclic way (if necessary) replicates the elements in a list until the resulting list is of certain exact length. The following serves as an example:
(replicate-to-length '(a b c) 8) => (a b c a b c a b)
(replicate-to-length '(a b c) 2) => (a b)
In other words, in (replicate-to-length lst n), take elements out of lst, cyclically if necessary, until you reach n elements.