14 May
2008
14 May
'08
1:10 a.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.