Explicitly state input/output of memoize key function.

Also, default key calculation occurs in `memof` function as an if-elif chain,
which is a little faster and is more transparent if the user inspects `memof`.