[Haskell-cafe] Stack Overflow, tail recursion and CPS

Günther Schmidt redcom at fedoms.com
Wed Jan 14 13:19:46 EST 2009

Hello Neil,

thanks, that did indeed work.

I guess I shot myself in the foot a bit here ...

Cause my real problem isn't actually with Map but with IxSet (from HAppS)  
which to my knowledge does not have some sort of strict insert function.  
Me trying to be really clever just used Map as a random example here  
quietly hoping to get confirmation for "Yes, CPS is the anwer to force  
evaluation here, keep digging in that direction boy", or a straight CPS  
solution which I then would just translate to my problem.

Um ...

Didn't work, you were to clever, thanks a bunch Neil :)


Am 14.01.2009, 18:32 Uhr, schrieb Neil Mitchell <ndmitchell at gmail.com>:

> Hi
>> I have changed the insertion algo to use foldl to make it  
>> tail-recursive but
>> still get a stack overflow as the "insert" remains lazy.
> Try foldl' and insertWith' - that should work.
> Thanks
> Neil

Erstellt mit Operas revolutionärem E-Mail-Modul: http://www.opera.com/mail/

More information about the Haskell-Cafe mailing list