|
|
|
|
|
by infinity0
3791 days ago
|
|
Apparently this s f g x = f x (g x)
k x y = x
b f g x = f (g x)
c f g x = f x g
y f = f (y f)
cond p f g x = if p x then f x else g x
fac = y (b (cond ((==) 0) (k 1)) (b (s (*)) (c b pred)))
is faster than this facAcc a 0 = a
facAcc a n = facAcc (n*a) (n-1)
fac = facAcc 1
and these are the first and second fastest.> Interestingly, this is the fastest of all of the implementations, perhaps reflecting the underlying graph reduction mechanisms used in the implementation. Could anyone elaborate on this a bit more? |
|