Listable
Usage
• Listable 是一个属性,该属性可以分配给一个符号 f ,指定函数 f 应当自动被线性作用于作为它的自变量出现的列表上
Notes
• Listable 函数有效的分别作用到列表中的每个元素,或如果有多于一个列表时,作用到每个列表中相应的元素。
• 大多数数学函数是 Listable. • 例如: Log is Listable. Log[ a,b,c ]  . • 在一个Listable函数中列表的所有参数必须有相同的长度。
• 不是列表的参数被拷贝和列表中的元素数目一样多的次数。 • 例如: Plus is Listable. a, b, c + x  . • 参见 Mathematica 全书 : 节 2.5.3.
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]=
|
|