...
| Code Block | ||
|---|---|---|
| ||
def add(a, b): ... return a + b ... >>> def double(a): ... return 2 * a ... >>> compose(double, add)(5, 6) 22 |
Also note that f • g that sequence f(); g(); is the same as compose(g, f) because that's g(f()), which would call f first. Weird but correct.
...