[Haskell-cafe] RE: Haskell-Cafe Digest, Vol 28, Issue 66

Scherrer, Chad Chad.Scherrer at pnl.gov
Tue Dec 20 14:14:08 EST 2005

> From: Daniel Carrera <daniel.carrera at zmsl.com>
> Robert Dockins wrote:
> > -divides a b = (mod a b == 0)
> > +divides a b = (mod b a == 0)
> Oh, thanks. My program assumed one way to define 'divides' 
> and the example assumed the other.
> When I wrote it I was thinking of (divides a) being a 
> function that tells me if the input divides 'a'.
> Thanks!
> Cheers,
> Daniel.


Have you used Haskell's infix notation? It can help keep the order
straight for operators like these. You can write

a `mod` b  -- instead of mod a b
a `divides` b -- instead of divides a b.

This can help with readability, too.

Chad Scherrer

More information about the Haskell-Cafe mailing list