Maps, Functions
ISETL has many pre-defined functions,
but the user may also define her/his own functions.
A func is the computational representation of a function,
as a map is the ordered pair representation, and
a tuple is the sequence representation.
Example
> f := func(x); $ The square function.
>> return x*x;
>> end;
> f(-3); f(0); f(5); f(3.25);
9;
0;
25;
10.563
>
Example
> os := func(p,q); $ Product of permutations.
>> if #p = #q then
>> return [(q(i)) : i in [1..#p] ];
>> end if;
>> end func;
> x := [1,3,2];
> y := [3,1,2];
> os(x,y); $ os is a function of two variables
[2, 1, 3];
> x .os y; $ Note the dot (alternate notation).
[2, 1, 3];
>