Task is to write a $function$ in GAP which takes as input a group $G$, an element $g∈G$ and a subgroup $H≤G$, and returns the elements in the coset $gH$ as a list. I am new to this software program and as far I understand code should look following:
function:=function(G,g,H)
local list, ...;
... (main code);
return list;
end;
My question is to how to write the main code?
The (universally recognized as beautiful and highly elegant) programming environment of GAP contains functions that make it easy to apply . Thus, to get the elements of a left coset, I would use
Note that there is no need to specify the whole group as extra argument.
It might be useful to sort the list of coset elements, to make comparison easier. For this, simply add a line
Sort(list);befor thereturncommand.