Created
March 2, 2017 11:24
-
-
Save zelinskiy/22345a405744ea83d2b2288a9c58f92c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mask [] [] = True | |
mask [] ['*'] = True | |
mask (x:xs) ['*'] = True | |
mask (x:xs) ms@('*':m:mss) = if m == x then mask xs mss else mask xs ms | |
mask (x:xs) (m:ms) = if m == x then mask xs ms else False | |
mask _ _ = False | |
main = do | |
print $ mask "abcdef" "abcdef" | |
print $ mask "abcdef" "ab*ef" | |
print $ mask "abcdef" "abcdef*" | |
print $ mask "abcdef" "*abcdef" | |
print $ mask "abcdef" "*" | |
print $ mask "abcdef" "ab*d*f" | |
print $ mask "abcdef" "*abcdef" | |
print $ mask "abcdef" "*abcdef" | |
print $ mask "abcdef" "*abcdef" | |
print "=======================" | |
print $ mask "abcdef" "abcf" | |
print $ mask "abcdef" "abcd" | |
print $ mask "abcdef" "cdef" | |
print $ mask "abcdef" "cdef" | |
print $ mask "abcdef" "*ccdef" | |
print $ mask "abcdef" "ab*bcdef" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment