[Haskell-cafe] xs not in scope
ky3 at atamo.com
Sun Nov 9 17:11:41 UTC 2014
On Mon, Nov 10, 2014 at 12:04 AM, Max Voit <max.voit+mlhc at with-eyes.net>
> last3::[a]-> Maybe a;
> last3  = Nothing
> last3 ([a]) = Just a
> last3 (_:xs) = last3 xs
> Notice that the last case will never be executed, as the matching is
> complete with the first two case.
Lists are tricky because of the special syntax.
The first case is  or Nil, the second is [a] which is equivalent to
Hence there's a remaining case of a Cons cell (:) that's NOT followed by
Nil (), which is the third case.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe