[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-cafe
Subject: Re: HUGS error: Unresolved overloading
From: Laszlo Nemeth <laszlo () ropas ! kaist ! ac ! kr>
Date: 2001-05-21 6:34:35
Message-ID: 200105210634.PAA14039 () ropas ! kaist ! ac ! kr
[Download RAW message or body]
Hi Mark,
> isSorted xs = and (zipWith (<=) xs (tail xs))
> In other words: "When is a list xs sorted? If each element in xs is
> less than or equal to its successor in the list (i.e., the corresponding
> element in tail xs)."
That's right ... under cbn! At the same time David's version with
explicit recursion is fine both in Hugs and in a strict language.
I recently started using Caml for day to day work and I get bitten
because of the 'lazy mindset' at least once a week. I am not in
disagreement with you over the style, but explicit recursion in this
case avoids the problem.
Cheers,
Laszlo
PS. Why not go all the way
and . uncurry (zipWith (<=)) . id >< tail . dup
with appropriate definitions for dup and >< (prod)?
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic