On 2005-03-16 02:52:39 -0800, Nicolas Oury <[EMAIL PROTECTED]> said:
instance Splittable Integer where split n = (2*n,2*n+1)
foo::(%x::Integer) => [a] -> [(a,Integer)] foo [] = [] foo (a:l) = (a,%x):(foo l)
test = let %x = 1 in foo [1..15000]
But, in this example, the numbering is linear and so test becomes quadratic. The main complexity of the program come from the numbering... (When you test it with ghci, this example is really slow)
I haven't played much with the Splittable class yet, but what would be wrong with
instance Splittable Integer where split n = (n,n+1)
?
-- Peter Davis <[EMAIL PROTECTED]> "Furthermore, I believe bacon prevents hair loss!"
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users