New pattern to reduce code duplication in mixed-type agrad functions (v2)

Not sure why the previous pull request got closed, it hasn't been merged...  Anyway, this leans on enable_if and a little template magic to greatly reduce the amount of code needed to implement mixed type function calls.  Comments?