From 7b4f0a7b410c13f45a69d9cc24dd34e383de24d6 Mon Sep 17 00:00:00 2001 From: ThomasBreuer Date: Mon, 14 Feb 2022 17:54:09 +0100 Subject: [PATCH] explain why `SameMutability` variants are chosen on the GAP side for the unary Julia operations `zero`, `one`, `-`, `inv` (This question came up in the discussion of #782.) --- docs/src/other.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/src/other.md b/docs/src/other.md index 95b4442b9..a78701bb4 100644 --- a/docs/src/other.md +++ b/docs/src/other.md @@ -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 ]