Verknüpfung von Funktionen


#!/usr/bin/python2.2
from math import sin, cos

def compose(fun1, fun2):
def inner(x):
return fun1(fun2(x))
return inner

def fun1(x):
return x + " world!"

def fun2(x):
return "Hello,"

sincos = compose(sin,cos)
f=sincos
print f(3)