Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

callCC oddness

Name: dddddddddddddddddddddddd 2007-03-31 15:40 ID:HM1BiqY2

for some reason

fac n = (`runCont` id) $
          callCC $ \k -> do
            when (n == 1) $ k 1
            return $ n * fac (n - 1)


is faster and uses less memory (for n=10000) than

fac' = product . enumFromTo 1

or [code]fac'' n = foldr1 (*) [1..n]

what gives /prog/?

Name: Anonymous 2007-04-01 0:10 ID:Ozs+yM4s

xor ax,ax
lul:
inc ax
cmp [ax],10000
jl lul

might be a bit faster

Name: Anonymous 2007-04-01 0:19 ID:Ozs+yM4s

dammit, why did i copy pasta from 6, it should have been
xor ax,ax
lul:
inc ax
cmp ax,10000d
jl lol

[ax] would try to read memory from 0 to 10000 , thus causing access violations each and every time(not that there woudnt be a legitimate use to do so, and i have seen situations where it was actually needed), but not in this case..

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List