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

| Very often I need a function to map a 2 argument function over a list and 
| a fixed argument. For example, if we call such function map1:
| (map1 #'list 'z '(a b c)) should return: '((z a) (z b) (z c))

recently, I had the same need, and used a circular list like this:

    (defun repeatingly (&rest args)
      (let ((list (copy-list args)))
	(nconc list list)))

    (mapcar #'list (repeatingly 'z) '(a b c))
 => ((z a) (z b) (z c))

this was modeled after the `constantly' function, but I don't know how good
style this is.

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