Google

Go to the first, previous, next, last section, table of contents.


map

map(function,arg0,arg1,...)
:: リスト, 配列の各要素に函数を適用する.
return
arg0 と同じ型のオブジェクト
function
函数名
arg0
リスト, ベクトル, 行列
arg1, ...
任意 (残りの引数)
  • arg0 の各要素を最初の引数, arg1 以下の残りの引数として 函数 function を呼び出し, arg0 の対応する要素の位置に 函数呼び出しの結果が入った同じ型のオブジェクトを生成して返す.
  • function は, ダブルクォートのない函数名を用いる.
  • function にプログラム変数は使えない.
  • arg0 がリスト, ベクトル, 行列以外の場合, 単に arg0, arg1, ... を引数として function を呼び出しその 結果を返す.
[82] def afo(X) { return X^3; }
[83] map(afo,[1,2,3]);
[1,8,27]


Go to the first, previous, next, last section, table of contents.