|
Go to the first, previous, next, last section, table of contents.
引数def sum(N) { for ( I = 1, S = 0; I <= N; I++ ) S += I; return S; }
これは, 1 から def clear_vector(M) { /* M is expected to be a vector */ L = size(M)[0]; for ( I = 0; I < L; I++ ) M[I] = 0; } この函数は, 引数のベクトルを 0 ベクトルに初期化するための函数である. また, ベクトルを引数に渡すことにより, 複数の結果を引数のベクトルに 収納して返すことができる. 実際には, このような場合には, 結果をリスト にして返すこともできる. 状況に応じて使いわけすることが望ましい. Go to the first, previous, next, last section, table of contents. |