--- /dev/null
+definition module MatchStrings\r
+\r
+head :: String -> Char\r
+tail :: String -> String\r
+is_gelijk :: String String -> Bool\r
+is_deelstring :: String String -> Bool\r
+is_deel :: String String -> Bool\r
+is_match :: String String -> Bool\r
--- /dev/null
+implementation module MatchStrings\r
+\r
+import StdEnv\r
+\r
+head :: String -> Char\r
+head "" = abort "Empty String"\r
+head s = s.[0]\r
+\r
+tail :: String -> String\r
+tail "" = abort "Empty String"\r
+tail s = s % (1, size s - 1)\r
+\r
+is_gelijk :: String String -> Bool\r
+is_gelijk "" "" = True\r
+is_gelijk a b = (size a == size b) && (head a == head b) && is_gelijk (tail a) (tail b)\r
+\r
+is_deelstring :: String String -> Bool\r
+is_deelstring _ "" = False\r
+is_deelstring a b = is_begin a b || is_deelstring a (tail b)\r
+\r
+is_begin :: String String -> Bool\r
+is_begin "" _ = True\r
+is_begin _ "" = False\r
+is_begin a b = head a == head b && is_begin (tail a) (tail b)\r
+\r
+is_deel :: String String -> Bool\r
+is_deel "" _ = True\r
+is_deel _ "" = False\r
+is_deel a b = head a == head b && is_deel (tail a) (tail b) || is_deel a (tail b)\r
+\r
+is_match :: String String -> Bool\r
+is_match a b = is_begin_match a b || size b > 0 && is_begin_match a (tail b)\r
+\r
+is_begin_match :: String String -> Bool\r
+is_begin_match "" _ = True\r
+is_begin_match a "" = head a == '*' && size a == 1\r
+is_begin_match a b\r
+| head a == '.' || head a == head b = is_begin_match (tail a) (tail b)\r
+| head a == '*' = is_begin_match a (tail b) || is_begin_match (tail a) b\r
+| otherwise = False\r
+\r
+//Start= (head pink_floyd, tail pink_floyd)\r
+//Start= is_gelijk "" " "\r
+//Start= is_deelstring "there" pink_floyd\r
+//Start= is_deelstring "there" marillion\r
+//Start= is_deel "there" marillion\r
+//Start= is_deel "she and her" pink_floyd\r
+//Start= is_deel radiohead pink_floyd\r
+//Start= is_match "*.here*.here*." pink_floyd\r
+//Start= is_match ".here.here." pink_floyd\r
+\r
+pink_floyd= "Is there anybody in there?"\r
+marillion= "Just for the record"\r
+radiohead= "There there"\r