On Wed, Feb 4, 2009 at 2:03 PM, Manlio Perillo <manlio_peri...@libero.it> wrote: > Max Rabkin ha scritto: >> >> [...] >> >> Then we can define >> (/.) :: (Real a1, Real a2, Fractional a) => a1 -> a2 -> a >> x /. y = fromRational $ toRational x / toRational y > >> [...] >> >> (//) :: (Integral b, Real a, Real a1) => a -> a1 -> b >> x // y = floor $ toRational x / toRational y >> >> Hope that helps, >> Max >> > > Yes, thanks. > > However there is still a *big* problem: it is inefficient.
It sure is. To get the type you asked for, one *has* to go via rationals. But... > Here is an Haskell version: > http://paste.pocoo.org/show/102801/ > > On my system it takes 30 seconds. You're only dividing integers by integers to get Doubles. x /. y = fromIntegral x / fromIntegral y works just fine in this case. --Max _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe