Created
February 21, 2012 08:38
-
-
Save aya-eiya/1875172 to your computer and use it in GitHub Desktop.
指定した文字列の大文字小文字の組み合わせ全パターンのリストを取得する #haskell
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
module Main where | |
import Data.List | |
import Data.Char | |
main | |
= print "ABCD" | |
getAllUpperLowerPattern str = f3 | |
where | |
f1 = sequence $ replicate (length str) "01" | |
f2 = map (\(fs,str)->zip fs str) $ zip f1 (replicate (length f1) str) | |
f3 = nub [a|cs<-f2,a<-[[if f=='0' then toUpper c else toLower c|(f,c)<-cs]]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment