Subject: Re: Elegant solution asked
From: Erik Naggum <>
Date: 1997/03/06
Newsgroups: comp.lang.lisp
Message-ID: <>

* Francis Leboutte
| Maybe you'll prefer this:
| USER<10> (defun circular (list) 
|            (let ((new-list (copy-list list)))
|               (rplacd (last new-list) new-list)
|               new-list))
| USER<11>  (mapcar #'list (circular '(z)) '(a b c))
| ((Z A) (Z B) (Z C))

I thought `repeatingly' (or `repeatedly', which I'm told is better a name)
was neat, because it provides a means to let a mapping function map
repeatedly over the object(s) that were the functions' arguments.  calling
it `circular' or `circular-list' says what it is, but not what it means;
there is no abstraction of purpose in sending it a list of the arguments,
quoted or otherwise.  actually, I think using a circular list with a
mapping function is a little "dangerous" unless there are other arguments
that have finite length, and it is also somewhat counter-intuitive to send
a circular list to a mapping function in the first place.  all of this led
me to discard the implementation-like name (which I used at first, too),
and then to use a more functionally abstract name.

I would like to hear opinions on whether this is good style, be it called
by a name that reflects the implementation or the purpose.

if you think big enough, you never have to do it