Generate a function.

Closes #7.