Utilities and macros for functional programming with closures