
13 May
2008
13 May
'08
7:40 p.m.
Darrin Thompson wrote:
These "tricks" going into Real World Haskell?
Some will, yes. For example, the natural and naive way to write Andrew's "mean" function doesn't involve tuples at all: simply tail recurse with two accumulator parameters, and compute the mean at the end. GHC's strictness analyser does the right thing with this, so there's no need for seq, $!, or the like. It's about 3 lines of code.