interesting problem

16 views
Skip to first unread message

mike

unread,
Jan 30, 2011, 3:46:05 PM1/30/11
to Study-HTDP
Here is an interesting problem;
;; my-permutations : a-word num => list of words
;; where a-word is a list of letters and num an integer < = the
length of a-word; construct a list
;; of all permutations of num length words (an n choose k number)
;; Of course you can use (arrangements...) from 12.4.1
;; the solution is really pretty
mike
;; (my-permutations '(a b c) 2) => '((a b) (a c) (b c)) a simple
example.

mike

unread,
Jan 30, 2011, 3:57:38 PM1/30/11
to Study-HTDP
Opps i am replying to myself; but i made a mistake
(my-permutations '(a b c) 2) => (apply-arrangements '((a b) (a c)
(b c)) ) will yield
the answer the interesting part is generating '((a b) (a c) (b c))
from '(a b c).
mike
Reply all
Reply to author
Forward
0 new messages