Created
September 12, 2011 06:56
-
-
Save kyonmm/1210726 to your computer and use it in GitHub Desktop.
文字列リストを辞書的に網羅する。
This file contains hidden or 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
String.metaClass.multiply = {String s -> | |
delegate+s | |
} | |
List.metaClass.multiply = { List l -> | |
result = [] | |
delegate.each{e1 -> | |
l.each{e2 -> | |
result << e1*e2 | |
} | |
} | |
return result | |
} | |
def r = [*"A".."Z"]+[*"A".."Z"]*[*"A".."Z"] | |
r.each{println it} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment