#haskell - Fri 9 Mar 2007 between 20:51 and 21:04

NY Lost Funds



roconnorPEG?
stepcuthttp://en.wikipedia.org/wiki/Parsing_expression_grammar
roconnorah, this goes back to the regexp suggestion
stepcuti believe there are a few packrat parser implemented in haskell, but they are not yet in wide-spread usage
http://repetae.net/computer/frisby/
roconnorparse l = let ("<TD ALIGN=\"LEFT\">",x) = splitAt (length prefix) l
(x',"</TD>\r") = splitAt 5 x
in x'
dmwitHow about something like (string "foo" >> sequence (repeat 5 char) >>= string "bar")?
Never mind, I'll stop trying to imagine how Parsec works, and just play with it a little first. =P
stepcutdmwit: that would parse 5 chars that appaer between "foo" and "bar" ?
chessguy@type \l -> let ("<TD ALIGN=\"\">",x) = splitAt (length prefix) l; (x',"</TD>\r") = splitAt 5 x in x'
lambdabotNot in scope: `prefix'
chessguy@type \l -> let ("<TD ALIGN=\"\">",x) = splitAt (length ?prefix) l; (x',"</TD>\r") = splitAt 5 x in x'
lambdabot(?prefix::[a]) => [Char] -> [Char]
stepcutroconnor: that is some unusual code you have there...
dmwitstepcut: I don't know, I have no idea how Parsec works.
chessguyi don't even get how that would be evaluated
dmwitThat was the intent, though.
stepcut> let "hi" = "hello" in putStrLn "hi"
lambdabot<IO ()>
stepcut> let "hi" = "hello" in "hi"
lambdabot"hi"
faxlol
chessguy?hoogle splitAt
lambdabotPrelude.splitAt :: Int -> [a] -> ([a], [a])
Data.PackedString.splitAtPS :: Int -> PackedString -> (PackedString, PackedString)
List.genericSplitAt :: Integral a => a -> [b] -> ([b], [b])
dmwitIt'll be a pattern match failure if a string of the wrong form is sent in, right?
stepcut> let str = "fooapplebar" in parse (do { string "foo" ; s <- count 5 anyChar ;string "bar" ; return s }) str str
lambdabotNot in scope: `string'
stepcuthrm, apparently lambdabot does not include Parsec ?
nominoloi think there's a hoogle plugin for emacs
then you can use your local ghci/hugs
er
stepcutdmwit: parse returns 'Either ParseError a', so if pass in an illegal string, it tells you where the parsing failed, and what it was expecting
nominoloadmittedly, these things are sort of unrelated ..
roconnorstepcut: I know it is 5 chars :)
stepcutroconnor: ah
roconnor: I forgot you said that ;)

Page: 2 9 16 23 30 37 44 51 58 65 72 79 86 93 

IrcArchive

NY Lost Funds