# Ticket #4419(closed defect: fixed)

Opened 5 years ago

## [with patch, positive review] conversion of Permutations to GAP not implemented

Reported by: Owned by: mhansen mhansen minor sage-3.2.1 combinatorics sage-combinat

### Description

The following fails

```sage: p = gap(Permutation('(1,2,3)'))
sage: q = gap(Permutation([()]))
sage: gap.Group([p, q])
```

because

```sage: gap(Permutation((1,2,3)))
[ 2 3 1 ]
```

## Change History

### comment:1 Changed 5 years ago by wdj

I don't see how this fixes the original problem. I get this:

```sage: p = gap(Permutation('(1,2,3)'))
sage: q = gap(Permutation('()'))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<snip>

ValueError: invalid literal for int() with base 10: ''
```

and this:

```sage: q = gap(Permutation(()))
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<snip>

TypeError: not enough arguments for format string
```

It seems to me you want Permutation to work like PermutationGroupElement? does here:

```sage: p = gap(PermutationGroupElement('(1,2,3)'))
sage: q = gap(PermutationGroupElement('()'))
sage: gap.Group([p, q])
Group( [ (1,2,3), () ] )
sage: gap.Group([p]) == gap.Group([p, q])
True
```

Is that correct?

### comment:2 Changed 5 years ago by mhansen

• Status changed from new to assigned

```sage: p = gap(Permutation('(1,2,3)'))
sage: q = gap(Permutation([()]))
sage: gap.Group([p, q])
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
```

Those things that you encountered are "bugs" in the constructor of Permutation. I always construct Permutations from their list notation.

### comment:3 Changed 5 years ago by saliola

• Summary changed from [with patch, needs review] conversion of Permutations to GAP not implemented to [with patch, positive review] conversion of Permutations to GAP not implemented

This patch should get a positive review because it fixes the conversion to gap problem:

```sage: p = Permutation('(1,2,3)')
sage: q = Permutation([()])
sage: gap.Group([p,q])
Group( [ (1,2,3), () ] )
```

The other issues noticed by wdj are problems with the Permutations constructor function, and I will open a new ticket for them.

### comment:4 Changed 5 years ago by saliola

The new ticket is here: #4569

### comment:5 Changed 5 years ago by mabshoff

• Status changed from assigned to closed
• Resolution set to fixed

Merged in Sage 3.2.1.alpha0