A list of elements of the form
, where
ranges over all integers between
and
can be created using the command
L:=[[a..b],i->f(i)]; . Here
is any
function whihc can be entered in GAP.
For example,
itself can be a list:
gap> L:=List( [1..10], i -> [i,i^2+1] ); [ [ 1, 2 ], [ 2, 5 ], [ 3, 10 ], [ 4, 17 ], [ 5, 26 ], [ 6, 37 ], [ 7, 50 ], [ 8, 65 ], [ 9, 82 ], [ 10, 101 ] ]
If
is Boolean-valued then there is another option
for creating a list. The Filtered command
only lists those elements for which
is true.
Here's an example:
gap> L:=List( [1..10], i -> IsOddInt(i) ); [ true, false, true, false, true, false, true, false, true, false ] gap> L:=Filtered( [1..10], i -> IsOddInt(i) ); [ 1, 3, 5, 7, 9 ]