[Haskell-cafe] Tutorial: Haskell for the Evil Genius
alex at stangl.us
Fri Sep 14 19:50:22 CEST 2012
On Fri, Sep 14, 2012 at 12:13:15PM -0400, Andrew Pennebaker wrote:
> I've gotten mixed feedback from Reddit for my tutorial. It provides an
> overview of how functional and declarative programming in Haskell empower
> baddies, increasing the accuracy and efficiency of their atomic
> superweapons. What do you guys think of my tutorial, Haskell for the Evil
> Genius <http://www.yellosoft.us/evilgenius/>?
Hopefully you'll get more feedback here, although my recent post here
soliciting feedback netted me nothing.
FWIW, my feedback is below.
Under Declarative, you aren't creating a "named expression, 2 + 2", really.
You are redefining (+).
Under Lazy, your example of binding fib 30 is not a good example of
memoization. With memoization you typically call the underlying computation
the first time, and memoize it for repeated retrieval later, not hardwire in
values at compile time. Here you never ever call the real fib at all. On top
of everything else, it'd be too easy to introduce a typo into one of your
hardwired constant values.
Under Infinite, you should use "sieve (n:ns)" pattern matching instead of
Subtle distinction, but returning () is not the same as returning nothing
You've got an unusual indentation scheme. Consider adopting a more standard
one for your tutorial.
In general, monotonically decreasing is not sufficient to prove you will hit
a base case. For example, decreasing by 5 would still be monotonically
decreasing, and could jump right over your base cases.
(Not arguing that the code is incorrect, but rather than your explanation is
a little misleading/incomplete.)
Again, further confusion about what memoization really is.
"Functions are already defined by their data structures; they are already
semantically bundled..." doesn't seem to make sense.
"... acts on the specific constructor, blasting fools, murdering crowds..."
makes it sound like fireOn actually has side effects.
More information about the Haskell-Cafe