[racket] extra exercises

From: Stephen Bloch (bloch at adelphi.edu)
Date: Mon Apr 16 19:31:51 EDT 2012

On Apr 16, 2012, at 5:18 PM, Neil Van Dyke wrote:

> ... if one is still looking for additional beginner programming exercises, I think that one not-totally-bad option is to start picking standard algorithms and data structures one can learn about by search the Web and in books (e.g, sorting, shuffling, searching, stringmanipulating) and trying to implement some of those.  Remember to make good unit test cases, and to verify your implementation both against your own understanding of what it should do, and against the output of other credible implementations you find.
> When finding algorithms on the Web and in books, be aware that most code and pseudocode examples you'll see will have pieces like "set variable x to the value of x + 1", and that Racket will indeed let you implement it just like that -- "(set! x (+ x 1))" -- but at some point you should also learn to implement these algorithms functionally, without using mutators like "set!".  So don't spend too much time learning "set!" to death by transliterating every bit of code you find in every one Knuth's books -- instead, learn "set!", and then move on to learning how to *not* use "set!".

If you haven't gotten to lists or vectors yet, sorting and searching aren't particularly good choices :-)

Roelof is working on structures in HtDP2e, and presumably hasn't gotten to lists yet.  But there are lots of interesting problems to solve on fixed-sized data, including lots of interactive GUI programs.  Eight or ten years ago, one of my CS1 students got bored with the class assignments and wrote a complete chess program using structs and the "world" teachpack.  (That student is working at Google now....)

Stephen Bloch
sbloch at adelphi.edu

Posted on the users mailing list.