I don't really see how recursing into some other inits function would help. The same laziness requirement should hold everywhere:

take (n+1) $ inits ([1 .. n] ++ undefined)  =  inits [1 .. n]

Maybe I don't understand what you mean properly.


On Sat, Jul 19, 2014 at 4:29 AM, Henning Thielemann <schlepptop@henning-thielemann.de> wrote:
Am 19.07.2014 10:25, schrieb David Feuer:

I'm not sure about the theory of it, but if I load the module in GHCi
and run
head $ last $ initsR [0..100000::Int]
I get a response *immediately*.
If I run
head $ last $ initsDL [0..100000::Int]
I wrote this email while waiting for that to complete, and gave up on
it. There may be an asymptotic performance bug here.

Sorry, I got the implementation of initsDL wrong (recursed into the wrong inits-function).