# Converting Sage groups to Gap groups

I'm trying to convert groups in Sage to groups in Gap in the SageMathCell environment (all the below code is being run on sagecell dot sagemath dot org ). I've seen indications for two ways of doing this, `gap(G)`

and `G.gap()`

. However, these don't seem equivalent. For instance, if I run the following code:

```
G1 = gap(SymmetricGroup(5))
print(type(G1))
test1 = gap.ConjugacyClassesSubgroups(G1)
print("success 1")
G2 = SymmetricGroup(5).gap()
print(type(G2))
test2 = gap.ConjugacyClassesSubgroups(G2)
print("success 2")
```

I get this output:

```
<class 'sage.interfaces.gap.GapElement'>
success 1
<class 'sage.libs.gap.element.GapElement'>
---------------------------------------------------------------------------
RuntimeError
[...]
TypeError: Gap produced error output
Error, Variable: 'Sym' must have a value
executing \$sage3:=Sym( [ 1 .. 5 ] );;
```

So it appears that only the `gap(G)`

functionality actually works to produce something I can run Gap computations on. This would be fine, except that `gap(G)`

does not actually seem to work for all groups! If I try to run

```
G3 = WeylGroup(["F", 4])
print(type(G3))
G4 = G3.gap()
print("constructed G4")
G5 = gap(G3)
print("constructed G5")
```

I get the output:

```
<class 'sage.combinat.root_system.weyl_group.WeylGroup_gens_with_category'>
constructed G4
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-1-6f93228822c9> in <module>
13 G4 = G3.gap()
14 print("constructed G4")
---> 15 G5 = gap(G3)
16 print("constructed G5")
[...]
TypeError: gap() takes exactly one argument (2 given)
```

What's the right way to convert Sage groups to Gap groups in a way that consistently lets me perform computations on them? I'm at a bit of a loss as to what's going wrong here.