Since I got interested in functional programming, I did a little research in the web, downloaded DrScheme and started to work through HtDP a few days ago. I know imperative languages (mostly C, Java, Ruby) fairly well, so I skimmed through the book, yet did all the exercises that contained writing scheme code.

Then I encountered exercise 12.4.2 [given a list, produce a list of its permutations]. I read it, started to code and failed terribly. I couldn't get it right and got frustrated.

So I fired up chrome and googled for a solution, but I couldn't find one. Just a few threads on the plt-scheme mailing list which didn't provide a solution but emphasized the usage of "design recipes". I googled some more for permutations, learned a little about the math background - which was interesting but didn't help me to solve 12.4.2, and found video lectures of Jerry Cain of Stanford which contained a spectacular permutation function but in the end didn't help me either.

In the end, I started over with HtDP and learned every little bit about "design recipes". Then I took pen and paper and designed the arrangements function using what I have learned. After that I fired up DrScheme, entered the 4 functions (including the given function arrangements) and check-expects with the examples for each function I came up with, and guess what? It worked right away :-D (this was a few minutes ago).

Thank you very much. I think learned my lesson.

Roman Sykora

Last modified: Stephen Bloch / sbloch@adelphi.edu