Created
October 18, 2011 07:19
-
-
Save pasberth/1294800 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
def curryargs(arg=None, args=()): | |
def _ca(next=None): | |
return curryargs(next, args + (arg,)) | |
if arg: | |
return _ca | |
else: | |
return args | |
def printargs(args): | |
for arg in args: | |
print(arg) | |
printargs(curryargs("1")("2")()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment