Maximum value in a list
sashan
sashang@ihug.co.nz
Mon, 05 May 2003 15:19:55 +1200
Liyang HU wrote:
>Given that you've already taken care of the empty case, (and assuming you
>think the maximum of an empty list is indeed zero) can't you just use foldr1
>instead of foldr? (foldr1 f l is equivalent to foldr f (head l) (tail l))
>
>
Thanks. Didn't know about foldr1 but should've thought of the definition.
>Have fun in your adventures with Haskell, :)
>/Liyang
>
>
Yeah...I thought I'd try it again after doing a basic course on it a few
years ago and liking the language. Now I want to do something practical
with it.
--
sashan
http://sashan.netfirms.com
--------------------------------------------------
Brain: Here we are, Pinky--at the dawn of time!
Pinky: Narf, Brain. Wake me at the noon of time.