Generalize 'dog' to a function.