
29 Sep
2010
29 Sep
'10
11:17 p.m.
I never realized that a guard can be used as an extension of a pattern. Is this recommended coding? elem n xs asks whether n is an element of xs elem :: (Eq a) => a -> [a] -> Bool elem _ [] = False elem n (x:_) | n == x = True elem n (_:xs) = elem n xs -- Russ Abbott ______________________________________ Professor, Computer Science California State University, Los Angeles Google voice: 424-242-USA0 (last character is zero) blog: http://russabbott.blogspot.com/ vita: http://sites.google.com/site/russabbott/ ______________________________________