[Haskell-cafe] general-revised

Ryan Bloor ryanbloor at hotmail.com
Sat Dec 8 18:59:29 EST 2007


hi
 
I have four functions below: What I want to do is have a way to parse more than one digit or more than one string head in ParseTrue. Any ideas...
 
removeSpace:: String -> StringremoveSpace = dropWhile (`elem` space)                   where space = [' ']
 
match :: String -> String -> (Bool, String)match word str    | ((isPrefixOf) (removeSpace word) (removeSpace str)) = (True,rest)   | otherwise = (False,str)     where rest = drop (length (removeSpace word)) (removeSpace str) parseDigit :: String -> [(Int, String)]parseDigit (x:xs)  | isDigit x = [(read [x],xs)] | otherwise = []
 
parseTrue :: String -> (Bool, String)parseTrue x = match "True" x
 
 
 
Ryan 
 
 
 
 
_________________________________________________________________
Celeb spotting – Play CelebMashup and win cool prizes
https://www.celebmashup.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071208/e3c960b1/attachment.htm


More information about the Haskell-Cafe mailing list