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

Point-free programming style

Name: Anonymous 2009-01-04 19:30

How do I write the factorial function in point-free?

fact n = foldr1 (*) [1..n]

Which is faster
add1 = 1 +
or
add1 x = 1 + x
???

Name: Anonymous 2009-01-05 13:59

>>37
The stack is an "array" too, it requires memory access unless you pass arguments as registers, that said, passing 10 arguments directly will use the stack on a x86, as you can only pass 2-3 arguments as registers, so you implementation would be either slower or have similar speed to one using an args array. If you really cared about speed of your benchmarking function, you would have coded it in asm, and used the CPU instruction which returns ticks, if such a thing exists on your platform( rdtsc instruction for x86), and probably would have inlined the entire benchmark function too.

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