[racket] HTDP exersise 12.4.2

From: Stephen Bloch (bloch at adelphi.edu)
Date: Sun Aug 28 17:08:17 EDT 2011

In addition to the request not to post complete solutions...

You have two good non-empty test cases for "arrangements", but no empty test case (and it wouldn't be a bad idea to include a length-1 test case).

My most serious criticism: you have NO test cases for ANY of the other functions.  How do you know what they're supposed to do (much less whether they do it) if you haven't written test cases for them?  My students frequently make the same mistake: they write test cases for the function I assigned, but not for any of the "helper" functions, as though the purpose of test cases were to satisfy the teacher rather than to help you write working programs.  EVERY nontrivial function (which includes all of these functions) should have test cases, written before you write any code for the function itself.

You've introduced numbers to a problem that doesn't involve numbers.  This usually indicates somebody who's still thinking in C or C++ and translating to Scheme/Racket rather than thinking "natively" in Scheme/Racket.

What should/does "insert-at-spot" or "create-com-word" do if the number is larger than 1 + the length of the word?

"how-many-letters" looks correct, but there's a predefined "length" function that does the same thing.

Stephen Bloch
sbloch at adelphi.edu

Posted on the users mailing list.