On Jan 6, 2008 4:40 PM, Jonathan Cast <[EMAIL PROTECTED]> wrote:
> let is always recursive in Haskell, so this is a recursive definition
> of pos. To break the recursion, use
>
>
> matchReverse (x:xs) (y:ys) pos = let (matched, pos') = matchReverse
> xs ys (pos + 1)
> in if matched then ((x==y), pos')
> else (False, pos')
Actually, I think he meant
matchReverse (x:xs) (y:ys) pos =
let (matched, pos') = matchReverse xs ys (pos + 1)
in if matched then ((x==y), pos) else (False, pos')
As as side note, GHC's flag -Wall would have warned about creating a
variable with a name already in scope.
--
Felipe.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe