[Haskell-cafe] Java or C to Haskell

Donald Bruce Stewart dons at cse.unsw.edu.au
Wed Sep 20 05:20:23 EDT 2006

> On Wed, Sep 20, 2006 at 01:31:22AM -0700, Carajillu wrote:
> > compare function just compares the two lists and return true if they are
> > equal, or false if they are not.
> > it is really a simple function, but I've been thinking about it a lot of
> > time and I can't get the goal. 
> I forgot, obviously, that lists are an instance of the Eq class...
> so, this is enough:
> comp l1 l2 = if l1 == l2 then True else False
> You never stop learning!
> andrea

which you would just write as:
    comp = (==)

and then you'd just use == anyway :)

-- Don

More information about the Haskell-Cafe mailing list