
# Anonymous Functions 

def apply_to_one(f):
    """calls the function f with 1 as its argument"""
    return f(1)

f = lambda x: x+4

x = apply_to_one(f) 
print(x)

x = apply_to_one( lambda x: x+4 ) 
print(x)


# You can assign lambdas to variables:
#
#   f = lambda x: 2 * x 
#
# Most people will tell you that you should just use def instead:
#
#   def f(x): return 2 * x 
#
