Download Gauss 11 User Manual

Transcript
Language Fundamentals
nms = &f1 | &f2 | &f3;
proc fi(x,i);
local f;
f = nms[i];
local f:proc;
retp( f(x) );
endp;
fi(x,2) will return f2(x). The ampersand is used to return the pointers to the procedures. nms is
a numeric vector that contains a set of pointers. The local statement is used twice. The first tells
the compiler that f is a local matrix. The ith pointer, which is just a number, is assigned to f. Then
the second local statement tells the compiler to treat f as a procedure from this point on; thus the
subsequent statement f(x) is interpreted as a procedure call.
Language
Fundamentals
6-43