Chapter 34. Nested Function

Compose functions by nesting function calls as arguments of other calls.

image

34.1 How It Works

By representing a DSL clause as a Nested Function, you’re able to reflect the hierarchic nature of the language in a way that’s mirrored in the host language, not just in a formatting convention.

A notable property of Nested Function is the way it affects the evaluation order of its arguments. Function Sequence and Method Chaining both evaluate the functions in a left-to-right sequence. Nested Function evaluates the arguments of a function before the enclosing function itself. I find this most memorable with the “Old MacDonald” ...

Get Domain Specific Languages now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.