This change is the "easy" part of #64, but to reduce the amount of duplicated
code, this change also modifies the internals of implementing a function.
The function identifier is now passed to the implementation as well, allowing
many implementations of similar functions to be collapsed more easily.