Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Haskell

Name: Anonymous 2009-01-27 20:20

Please help with my Haskell code. It is supposed to return the maximum element in a list but it doesn't work

lol :: [a] -> Nothing | a
lol [] = Nothing
lol [x] = x
lol (x:xs) = if x > lol xs then x else lol xs

Name: Anonymous 2009-01-28 13:42

>>23
If he had read it, he would know that recursion can be used to write more elegant solutions and that iterative processes can be implemented in a recursive manner. A blanket statement like ``recursion is wrong" merely shows his ignorance.

Also, unless he is programming on systems with limited resources (e.g. I program microcontrollers), why should he care about some resources being wasted. Moore's law is continuing to hold and should for some time.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List