Will Fitzgerald <fitzgerald@neodesic.com> Doug Currie 11 Jan 1999 19:09 UTC

Michael Sperber <xxxxxx@Informatik.Uni-Tuebingen.De> writes:
>>>>>> "Will" == Will Fitzgerald <xxxxxx@neodesic.com> writes:
>
>Will> May I suggest the following addition to the SRFI-1 list library,
>Will> Common Lisp's LDIFF:
>
>Will> I think a reasonable definition is:
>Will> [...]
>[...]
>Could you suggest possible uses for this procedure?

The following gem is by Duncan Smith...

(defun permute (ls)
  (if (null ls)
    nil
    (if (null (cdr ls))
      (list ls)
      (mapcon
       #'(lambda (x)
           (mapcar
            #'(lambda (y)
                (cons (car x) y))
            (permute (nconc (ldiff ls x) (cdr x)))))
       ls))))

e