#!/usr/bin/env python # wherever you see 'L' below, pretend # that it is the lambda symbol. # this is essentially the same program as # (Lx.Ly.yx)xy def swap2(x): def swap1(y): return (y,x) return swap1 # see, the program swaps "a" and "b" print(swap2("a")("b")) # but we can also do it in two steps # here, swap2 returns a function, which # is waiting for one more argument f = swap2("a") print(f) # we give it one more argument print(f("b"))