Catalan numbers: Difference between revisions

Content deleted Content added
→‎{{header|AutoHotkey}}: AutoHotkey example added
Line 1,600: Line 1,600:


def memoize(func):
def memoize(func):
func.__cache = {}
cache = {}
def memoized(key):
def memoized(key):
# Returned, new, memoized version of decorated function
# Returned, new, memoized version of decorated function
cache = func.__cache
if key in cache:
if key in cache:
return cache[key]
return cache[key]
Line 1,635: Line 1,634:
fmt = '%-10s %-10s %-10s'
fmt = '%-10s %-10s %-10s'
print ((fmt % tuple(c.__name__ for c in defs)).upper())
print ((fmt % tuple(c.__name__ for c in defs)).upper())
print (fmt % tuple(['='*10]*3))
print (fmt % (('='*10,)*3))
for r in zip(*results):
for r in zip(*results):
print (fmt % r)
print (fmt % r)