Closures
Five lessons on the object behind { }: the implicit it and typed parameters, the delegate a builder uses, partial application and composition, the cache and the trampoline, and the way a closure travels as an argument and comes back from a method.
5.1
Closures, it and parameters
the braces, the implicit it, typed parameters and the value a closure returns
Open
5.2
delegate and owner
the three objects a closure sees, and the resolve strategy that picks one
Open
5.3
Currying and composition
partial application, the composed closure and the argument order
Open
5.4
Memoize and trampoline
caching a closure result, and recursion that does not grow the stack
Open
5.5
Closures as arguments
the last-argument rule, Closure versus a lambda, and a method that returns a closure
Open