[Haskell-fr] Fractional etc...
Dan Popa
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
level 7
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!
Dan
--- 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
> integer??
> > 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 ->
> a
> divideByI a b = a / fromIntegral b
>
> --
> Jedaï
> _______________________________________________
> Haskell-fr mailing list
> Haskell-fr at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-fr
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the Haskell-fr
mailing list