Kevin R Gue <krgue@nps.navy.mil> wrote:
+---------------
| Try the code in Structure and Interpretation of Computer Programs (SICP) by
| Abelson and Sussman, pages 245-260. The code is there, but, frankly, I have
| been unable to get it to work.
+---------------
I had better luck with the code in SICP 2nd Ed., pages 115-124, which
uses a dialect a lot closer to R4RS, once you (define nil '()) and
the like.
> (permutations '(a b c d))
((a b c d) (a b d c) (a c b d) (a c d b) (a d b c) (a d c b)
(b a c d) (b a d c) (b c a d) (b c d a) (b d a c) (b d c a)
(c a b d) (c a d b) (c b a d) (c b d a) (c d a b) (c d b a)
(d a b c) (d a c b) (d b a c) (d b c a) (d c a b) (d c b a))
(Oh, and I changed "filter" to use "equal?" instead of "=", to allow
symbols...)
-Rob
-----
Rob Warnock, 7L-551 rpw3@sgi.com
Silicon Graphics, Inc. http://reality.sgi.com/rpw3/
2011 N. Shoreline Blvd. Phone: 415-933-1673 FAX: 415-933-0979
Mountain View, CA 94043 PP-ASEL-IA