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

Udo Stenzel u.stenzel at web.de
Tue Apr 24 14:34:28 EDT 2007


Bryan O'Sullivan wrote:
> 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?

Oops, you're right, this is a fairly recent addition.  


-Udo
-- 
Walk softly and carry a BFG-9000.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20070424/a63541b2/attachment.bin


More information about the Haskell-Cafe mailing list