
Oops, not quite. "otherwise ==" should be "otherwise =". Looks like
you already go this from the first one, but guard syntax looks like:
defn
| cond1 = ...
| cond2 = ...
| ...
| otherwise = ...
(otherwise is not actually necessary; it is just a synonym for True)
Luke
On Dec 6, 2007 7:09 AM, Luke Palmer
Just remove that if. What comes after | is already a conditional.
Luke
On Dec 6, 2007 7:03 AM, Ryan Bloor
wrote: hi
I have a matching problem... I am wanting to identify whether or not a string is an opening substring of another (ignoring leading spaces). I have this: word is a single word and str is a string.
match :: String -> String -> (Bool, String) match word str | if removeSpace str `elem` (removeSpace word) ++ rest = (True, rest) | otherwise == (False,str) where rest = str
Any help?
Ryan
________________________________ Can you guess the film? Search Charades! _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe