Previous: Field, Up: Deconstruction


2.7.8.2 Fan

In cases where a deconstructions would be needed to apply the same function to both sides of a pair, the overhead can be avoided by means of a property of the virtual machine intended for that purpose.

A silly definition of fan implying the following theorem is helpful in expressing such an application.

T14
[[fan]] f = ((nil,nil),((nil,f),(nil,nil)))

The virtual machine recognizes when an application has the form shown above, and uses f as a function to be applied to both sides of the argument.

P13
([[fan]] f) (x,y) = (f x,f y)