[Haskell-fr] Fractional etc...
popavdan at yahoo.com
Mon Nov 5 14:01:55 EST 2007
The stoty of divison may continue:
The function may be named as an operator
we can declare it's level of priority and how can it
may associate values: left associative and priority
infixl 7 ///
And the required operator is ready to be used.
Don't forget: Haskell allow the programmer to define
it's own operators, using 10 levels of priority, being
left, or right or no-associative. Also, data
constructors like : of the lists can be (re)defined as
you wish. Including their priority and associativity!
--- Chaddaï Fouché <chaddai.fouche at gmail.com> wrote:
> Le 30/10/07, Dupont
> Corentin<corentin.dupont at gmail.com> a écrit :
> > There must be a way to divide a real by an
> > My integer is eventually a "number of elements" as
> in the exemple of Dan.
> > How would you compute a mean then?
> No, you can't "divide a real by an integer", but you
> can introduce the
> integer in the reals and divide by this.
> divideByI :: (Fractional a, Integral b) => a -> b ->
> divideByI a b = a / fromIntegral b
> Haskell-fr mailing list
> Haskell-fr at haskell.org
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
More information about the Haskell-fr