I have a list with entries like
e:=[[[1,2]],[[3,4]],[[5,6]]];
I want to remove double list brackets to get a list looking like
result:=[[1,2],[3,4],[5,6]];
How can I do this in GAP?
I have a list with entries like
e:=[[[1,2]],[[3,4]],[[5,6]]];
I want to remove double list brackets to get a list looking like
result:=[[1,2],[3,4],[5,6]];
How can I do this in GAP?
A one-liner would be
gap> List(e,x->x[1]);
[ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
If you want to modify the list in place, do
gap> for i in [1..Length(e)] do
> e[i]:=e[i][1];
> od;
gap> e;
[ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]