Transformer implementation of first-class functions