Advertisement
Guest User

as

a guest
Oct 7th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- Задача 9 -----------------------------------------
  2. toAttributes :: [String] -> Attributes
  3. toAttributes [] = []
  4. toAttributes [_] = error "Bad data for toAttributes"
  5. toAttributes (name:value:ect) = (name, value):(toAttributes ect)
  6.  
  7. parseAttributes :: String -> (Attributes, String)
  8. -- Передумова: Рядок, що містить XML-атрибути, синтаксично вірний
  9. parseAttributes str = (\(a1, a2) -> (toAttributes (filter (\x -> x /= "") (splitOneOf " =\"" a1)), drop 1 a2)) (break ('>' ==) str)
  10. With no comments
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement