Hello Felipe, Wednesday, October 11, 2006, 4:47:59 AM, you wrote:
> Why does this works? "Yet Another Haskell Tutorial" teaches that > pattern matching occurs at one stage and guard processing at other, > and that there's no back (page 94). something is definitely wrong - either book or your understanding. it's very widely used feature, i just took a quick scan of Hugs Prelude and found a lot of its uses: (!!) :: [a] -> Int -> a xs !! n | n<0 = error "Prelude.!!: negative index" [] !! _ = error "Prelude.!!: index too large" (x:_) !! 0 = x (_:xs) !! n = xs !! (n-1) lexmatch (x:xs) (y:ys) | x == y = lexmatch xs ys lexmatch xs ys = (xs,ys) showLitChar c | c > '\DEL' = showChar '\\' . protectEsc isDigit (shows (fromEnum c)) showLitChar '\DEL' = showString "\\DEL" x ^ 0 = 1 x ^ n | n > 0 = .... _ ^ _ = error "Prelude.^: negative exponent" i don't even say that i use this feature every day :) -- Best regards, Bulat mailto:[EMAIL PROTECTED] _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe