[Haskell-cafe] Dividing integers?
Jon Fairbairn
Jon.Fairbairn at cl.cam.ac.uk
Thu Mar 18 15:21:26 EST 2004
On 2004-03-18 at 15:08+0100 Ferenc Wagner wrote:
> "Matias Hernandez" <matiash at artech.com.uy> writes:
>
> > I mean, apparently "/" is not defined for integers but I
> > don't know how to "cast" the result of the length function
> > into a Double...
> >
> > Prelude> (length [1,2]) / 3
>
> Literal 2 means fromIntegral 2, but length::[a]->Int.
Note also
Data.List.genericLength :: Num a => [b] -> a
--
Jón Fairbairn Jon.Fairbairn at cl.cam.ac.uk
More information about the Haskell-Cafe
mailing list