Skip to content

Instantly share code, notes, and snippets.

@TakashiHarada
Created August 20, 2016 15:03
Show Gist options
  • Save TakashiHarada/0537c4d2adfa34ed2eb80804794e4895 to your computer and use it in GitHub Desktop.
Save TakashiHarada/0537c4d2adfa34ed2eb80804794e4895 to your computer and use it in GitHub Desktop.
makeBitString :: Int -> [String]
makeBitString 0 = []
makeBitString 1 = ["0","1"]
makeBitString w = map ('0':) (makeBitString (w-1)) ++ map ('1':) (makeBitString (w-1))
makeMaskZeroString :: Int -> [String]
makeMaskZeroString w = ((map oneToMask) . makeBitString) w
where
oneToMask :: String -> String
oneToMask = (map (\c -> if c == '1' then '*' else c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment