Mathematica 9 is now available
 Documentation / Mathematica / Built-in Functions / Programming / Attributes  /
Listable

  • Listable is an attribute that can be assigned to a symbol f to indicate that the function f should automatically be threaded over lists that appear as its arguments.
  • Listable functions are effectively applied separately to each element in a list, or to corresponding elements in each list if there is more than one list.
  • Most built-in mathematical functions are Listable.
  • Example: Log is Listable. Log[ a,b,c ].
  • All the arguments which are lists in a Listable function must be of the same length.
  • Arguments that are not lists are copied as many times as there are elements in the lists.
  • Example: Plus is Listable. a, b, c + x.
  • See the Mathematica book: Section 2.5.3.
  • See also: Thread, Map, Sequence.

    Further Examples

    ff didn't get mapped over the list until it was made listable.

    In[1]:=

    Out[1]=

    In[2]:=

    In[3]:=

    Out[3]=

    This restores ff to be what it was originally.

    In[4]:=

    In[5]:=

    Out[5]=



    Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
    THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
    SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.