Question About lists
Jong Keun Na
jongkn@microsoft.com
Tue, 31 Dec 2002 13:27:29 +0900
> long =3D sum . map (const 1)
How's this?
/JongKeun
-----Original Message-----
From: William Lee Irwin III [mailto:wli@holomorphy.com]=20
Sent: Tuesday, December 31, 2002 5:18 AM
To: Artie Gold
Cc: Cesar Augusto Acosta Minoli; haskell@haskell.org
Subject: Re: Question About lists
On Mon, Dec 30, 2002 at 01:47:37PM -0600, Artie Gold wrote:
> One suggestion, though is that you're working too hard; there's really
> no reason to define a locally defined function. The much simpler:
> long [] =3D 0
> long (x:xs) =3D 1 + long xs
> will do quite nicely.
> HTH,
> --ag
There is already a length function in List and/or the Prelude.
Bill
_______________________________________________
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell