Refactor match-dependent functions to use generalized higher order function.
Merge pull request #5 from kevmo/higher-order

Refactor match-dependent functions to use generalized higher order funct...