RE: Question About lists
long = sum . map (const 1) How's this?
/JongKeun -----Original Message----- From: William Lee Irwin III [mailto:wli@holomorphy.com] 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 [] = 0 long (x:xs) = 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
participants (1)
-
Jong Keun Na