Created
May 2, 2012 05:14
-
-
Save bgnori/2573990 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
import sys | |
def _each(f, xs): | |
x = xs[0] | |
f(x) | |
if xs[1:]: | |
_each(f, xs[1:]) | |
def _shortest(i, *rs): | |
def f(r): | |
try: | |
x = r[i] | |
except IndexError: | |
print r | |
sys.exit(0) | |
_each(f, rs) | |
_shortest(i+1, *rs) | |
def shortest_r(*rs): | |
_shortest(0, *rs) | |
print shortest_r([1, 2], [3, 4, 5], [6, 7]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pythonで再代入・破壊変更禁止(for文禁止)は苦しいね。