Ch 12: 12.4 One More Example

Convert environment to a function