[Haskell-cafe] Re: Haskell version of Norvig's Python Spelling Corrector

Bryan O'Sullivan bos at serpentine.com
Tue Apr 24 11:33:54 EDT 2007


Udo Stenzel wrote:

> There is another bug of this sort in your code.  Consider
> 
>>         incWordCount w m = M.insertWith (+) w 1 m
> 
> There is no reason to evaluate the sum inside the map, instead an
> unevaluated thunk is put in there.

Would not Data.Map.insertWith' do the trick?

	<b


More information about the Haskell-Cafe mailing list