Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
#MonthOfCode day 23 - meta
# This shows how we can define and use a META-function in python
def produce_incrementor( step):
''' it produces various increment functions'''
return lambda u:u+step
print "three by three"
increm_three = produce_incrementor(3)
k=0
while k < 34:
print k
k = increm_three( k)
print "eleven by eleven"
increm_three = produce_incrementor(3)
k=0
while k < 34:
print k
k =\
produce_incrementor(11)(k) #immediate call of the func returned by produce_incrementor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment