27.13 Operations for Lists

list * obj
obj * list

The operator * evaluates to the product of list list by an object obj. The product is a new list that at each position contains the product of the corresponding element of list by obj. list may contain holes, in which case the result will contain holes at the same positions.

The elements of list and obj must be objects of the following types; integers (see Integers), rationals (see Rationals), cyclotomics (see Cyclotomics), elements of a finite field (see Finite Fields), permutations (see Permutations), matrices (see Matrices), words in abstract generators (see Words in Abstract Generators), or words in solvable groups (see Words in Finite Polycyclic Groups).

    gap> [ 1, 2, 3 ] * 2;
    [ 2, 4, 6 ]
    gap> 2 * [ 2, 3,, 5,, 7 ];
    [ 4, 6,, 10,, 14 ]
    gap> [ (), (2,3), (1,2), (1,2,3), (1,3,2), (1,3) ] * (1,4);
    [ (1,4), (1,4)(2,3), (1,2,4), (1,2,3,4), (1,3,2,4), (1,3,4) ] 

Many more operators are available for vectors and matrices, which are Operations for Matrices).

Previous Up Top Next
Index

GAP 3.4.4
April 1997