IO Swapping Leads You There And Back Again (Extended Abstract)

TABA (“There And Back Again”) [DG02], proposed by Danvy and Goldberg, is a special but powerful programming pattern where a recursive function traverses lists at return time. Their idea is that the recursive calls get us there (typically to a empty list) and the returns get us back again while traversing the list. A typical example is the symbolic convolution function cnv which accepts two lists, [x0, x1, . . . , xn] and [y0, y1, . . . , yn], and computes a new list [(x0, yn), (x1, yn−1), . . . , (xn, y0)]. This can be naively specified as follows.