2
$\begingroup$

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)) $$

$\endgroup$
5
  • $\begingroup$ 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. $\endgroup$ Commented Jul 11, 2013 at 9:34
  • $\begingroup$ @Luke, now I have to decide between three in place of two, nice job. ;) $\endgroup$
    – Kaveh
    Commented Jul 11, 2013 at 9:47
  • 1
    $\begingroup$ $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. $\endgroup$ Commented Jul 11, 2013 at 10:58
  • 3
    $\begingroup$ 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. $\endgroup$ Commented Jul 11, 2013 at 12:15
  • $\begingroup$ 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. $\endgroup$ Commented Jul 11, 2013 at 21:24

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.