[Haskell-cafe] what is the fastest way to extract variables
from a proposition?
ajb at spamcop.net
ajb at spamcop.net
Wed Feb 20 23:53:13 EST 2008
G'day all.
Quoting Cetin Sert <cetin.sert at gmail.com>:
> It is astonishing to see that your version actually performs the worst (at
> least on my machine).
On your example, I'm not surprised:
> plong 0 = Var 0
> plong n | even n = Or (Var n) (plong (n-1))
> | otherwise = And (Var n) (plong (n-1))
This is effectively a singly linked list. I would expect my (well, I
didn't invent it) to work better on something that didn't have this
unique structure, such as:
test 0 = Var 0
test n | even n = Or (Var n) (test (n-1))
| otherwise = And (test (n-1)) (Var n)
Cheers,
Andrew Bromage
More information about the Haskell-Cafe
mailing list