[Haskell-cafe] least fixed points above something

Neil Mitchell ndmitchell at gmail.com
Thu Mar 19 12:34:11 EDT 2009

> Can you give an example of when CSE would not be the way to go?

if length (replicate 'a' 10000) == 1 then [] else head (replicate 'a' 10000)

This program will use O(1) memory. If we perform CSE:

if length x == 1 then [] else head x
  where x = replicate 'a' 10000

Now we use 10000 cells of memory.



More information about the Haskell-Cafe mailing list