Skip to content

Commit

Permalink
explain why SameMutability variants are chosen
Browse files Browse the repository at this point in the history
on the GAP side for the unary Julia operations `zero`, `one`, `-`, `inv`

(This question came up in the discussion of #782.)
  • Loading branch information
ThomasBreuer authored and fingolfin committed Feb 14, 2022
1 parent 9978529 commit 081f6dc
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions docs/src/other.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ GAP operations.
| `<` | `LT` |
| `==` | `EQ` |

The reason why four `SameMutability` operations are chosen in this list
is as follows.
In GAP, *binary* arithmetic operations return immutable results if and only if
the two arguments are immutable.
Thus it is consistent if *unary* arithmetic operations return a result
with the same mutability as the argument.
Note that GAP provides several variants of these unary operations,
regarding the mutability of the result
(`ZeroMutable`, `ZeroImmutable`, `ZeroSameMutability`, etc.),
but here we have to choose one behaviour for the Julia function.

```jldoctest
julia> l = GAP.julia_to_gap( [ 1, 3, 7, 15 ] )
GAP: [ 1, 3, 7, 15 ]
Expand Down

0 comments on commit 081f6dc

Please sign in to comment.