[racket] Rosetta Code
A few minutes ago, Danny Yoo wrote:
> Yup; I've been doing so a little bit, fixing up some of the code
> snippets so they work on sequences rather than just on lists, and
> using "raise-argument-error" in favor of just plain error, since the
> error messages are better. For example:
>
> http://rosettacode.org/wiki/Dot_product#Racket
> http://rosettacode.org/wiki/A%2BB#Racket
Two comments:
* IMO having complete #lang-ed files is much better, since people get
a working template file rather than a repl demonstration.
* -1 for the pedantics of errors etc in the second example -- I think
that the main goal of these things is for quick impressions, and for
that second example, a half-line
(+ (read) (read))
is *much* better-looking. For extras like error checking, I'd defer
them for an additional extended example with more stuff in. (But in
the case of error checking, I'd probably still skip it.)
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!