[racket] extra exercises
You are so right, Neil,
I've been slowly learning more and more idiomatic Racket. Some things I've
picked up:
1) avoid mutators (see above)
2) avoid side-affects, use return values
3) Use list comprehensions and other powerful procedures (for*, for/list,
foldl, map, etc)
4) Don't be afraid to write tiny procedures while you are feeling your way
through a problem/solution.
5) Use the interactions pane in DrRacket to work on code with test inputs
6) Use the check and test procedures from the test-engine/racket-tests
module
7) more to be learned!
It's a great feeling to take a clunky imperative solution and transform it
into a sleek functional solution!
-Joe
On Mon, Apr 16, 2012 at 2:18 PM, Neil Van Dyke <neil at neilvandyke.org> wrote:
> 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.)
>
> 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.
>
> 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!".
>
> Neil V.
>
> --
> http://www.neilvandyke.org/
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/**users <http://lists.racket-lang.org/users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120416/7536d797/attachment.html>