You are so right, Neil,<div><br></div><div>I've been slowly learning more and more idiomatic Racket. Some things I've picked up:</div><div><br></div><div>1) avoid mutators (see above)</div><div>2) avoid side-affects, use return values</div>
<div>3) Use list comprehensions and other powerful procedures (for*, for/list, foldl, map, etc)</div><div>4) Don't be afraid to write tiny procedures while you are feeling your way through a problem/solution.</div><div>
5) Use the interactions pane in DrRacket to work on code with test inputs</div><div>6) Use the check and test procedures from the test-engine/racket-tests module</div><div>7) more to be learned!</div><div><br></div><div>It's a great feeling to take a clunky imperative solution and transform it into a sleek functional solution!</div>
<div><br></div><div>-Joe</div><div><br><div><br><div class="gmail_quote">On Mon, Apr 16, 2012 at 2:18 PM, Neil Van Dyke <span dir="ltr"><<a href="mailto:neil@neilvandyke.org">neil@neilvandyke.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">A good thing about exercises coming from an introductory textbook is that they are usually appropriate for the material instruction that the student has received at that point in the book. (Ideally, there is a mostly linear progression through the book.)<br>
<br>
However, 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.<br>
<br>
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!".<br>
<br>
Neil V.<span class="HOEnZb"><font color="#888888"><br>
<br>
-- <br>
<a href="http://www.neilvandyke.org/" target="_blank">http://www.neilvandyke.org/</a></font></span><div class="HOEnZb"><div class="h5"><br>
____________________<br>
Racket Users list:<br>
<a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/<u></u>users</a><br>
</div></div></blockquote></div><br></div></div>