# Does a function distribute over lists or does it commute with them?

Assume that we have an operation $f$ such that $$f([a_0,\ldots, a_n])= [f(a_0),\ldots,f(a_n)]$$

Do we say that $f$ distributes over lits or do we say it commutes with lists? Which one is the correct way of expressing this property?

How about the following? What do we say for the relation between $f$ and $\vec{a} = a_0,\ldots,a_n$? $$f(g(\vec{a})) = g(f(\vec{a})) = g(f(a_0),\ldots,f(a_n))$$

• I don't have a reference on hand, but a dim memory suggests "component-wise function". If I had to choose between distributive and commutative, I'd go with distributive. Jul 11, 2013 at 9:34
• @Luke, now I have to decide between three in place of two, nice job. ;) Jul 11, 2013 at 9:47
• $f$ has a different type on the left and right hand side of the equation – unless it is polymorphic. I'd go with distributive, too. Jul 11, 2013 at 10:58
• As @DaveClarke points out: $f_{\mathrm{list}}([a_0,\dots, a_n]) = [f_{\mathrm{element}}(a_0),\ldots,f_{\mathrm{element}}(a_n)]$. So I'd say, "$f_{\mathrm{list}}$ maps $f_{\mathrm{element}}$ over lists." I think we also say that any function that maps over lists is linear with respect to the list concatenation (addition) operation because $f_{\mathrm{list}}(a+b) = f_{\mathrm{list}}(a) + f_{\mathrm{list}}(b)$. map is what it's actually called in most programming languages too, so bonus. Jul 11, 2013 at 12:15
• Suggestion "componentwise" by @Luke seems in line with suggestion by wikipedia (taking the difference between operations and functions for granted). Some people seem to say it is an elementwise function. Jul 11, 2013 at 21:24