When a function returns a tuple, for example the value of the function and its derivative:

f(x) = x^2, 2x

y, ∂x = f(2.)

Would you expect this pattern to work with broadcast or map? For example:

y, ∂x = f.([2., 3.])

y, ∂x = map(f, [3., 4., 5.])

Unfortunately this doesn’t work. The return type is an array of tuples, not tuple of arrays. For my automatic differentiation library I had to code my own version of broadcast (called it multicast) that does returns a tuple. But I still miss the short syntax of .( and the chain / fuse broadcast performance improvements.

What do you think is the right behavior for broadcast / map from the user perspective?