We know that some GAP functions present additional options in their signature. For example, consider the IsomorphicSubgroups function, if we set findall to false, it only finds one isomorphic subgroup and stops, e.g.,
gap> IsomorphicSubgroups(SmallGroup(8,3),SmallGroup(4,2):findall:=false);
[ [ f1, f2 ] -> [ f1*f3, f1 ] ]
I've used PageSource(IsomorphicSubgroups) but have failed to figure out how to do it. I would be glad if someone can explain how we can write such functions by giving a simple example.
I also wonder about whether we can define functions sharing the same name with different signatures.
I'm, not sure what a signature would be, but what is used here is an option. The code for
IsomorphicSubgroupscallsto go in the case of only finding one subgroup, otherwise in one to find all. If no option is given when calling the function
ValueOption("findall")would returnfail. You can use any string as your own option, and there is no need to formally declare it.