A request for power set code was posted by ·····@andrew.cmu.edu
(Pankaj S. Mody)
> compute-powerset should work as follows
> (compute-powerset '(a b c)) ---> '((a b c) (a b) (a c) (b c) (a) (b) (c) nil)
Try the following (I shortened the name):
(defun powerset (liz)
(cond (liz
(nconc (mapcar #'(lambda (subset) (cons (first liz) subset))
(cons nil (powerset (cdr liz))))
(powerset (cdr liz))))))
That was fun! I hope it wasn't homework.
I apologize for the messy appearance of the answer.
Tom Kramer
······@cme.nist.gov