{"action":"created","issue":{"url":"https://api.github.com/repos/gap-system/gap/issues/2675","repository_url":"https://api.github.com/repos/gap-system/gap","labels_url":"https://api.github.com/repos/gap-system/gap/issues/2675/labels{/name}","comments_url":"https://api.github.com/repos/gap-system/gap/issues/2675/comments","events_url":"https://api.github.com/repos/gap-system/gap/issues/2675/events","html_url":"https://github.com/gap-system/gap/pull/2675","id":346617197,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA1NDM4Mzgz","number":2675,"title":"`ViewString` methods for various types of objects","user":{"login":"ThomasBreuer","id":25204833,"node_id":"MDQ6VXNlcjI1MjA0ODMz","avatar_url":"https://avatars3.githubusercontent.com/u/25204833?v=4","gravatar_id":"","url":"https://api.github.com/users/ThomasBreuer","html_url":"https://github.com/ThomasBreuer","followers_url":"https://api.github.com/users/ThomasBreuer/followers","following_url":"https://api.github.com/users/ThomasBreuer/following{/other_user}","gists_url":"https://api.github.com/users/ThomasBreuer/gists{/gist_id}","starred_url":"https://api.github.com/users/ThomasBreuer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThomasBreuer/subscriptions","organizations_url":"https://api.github.com/users/ThomasBreuer/orgs","repos_url":"https://api.github.com/users/ThomasBreuer/repos","events_url":"https://api.github.com/users/ThomasBreuer/events{/privacy}","received_events_url":"https://api.github.com/users/ThomasBreuer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-08-01T14:09:55Z","updated_at":"2018-08-02T15:47:57Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/gap-system/gap/pulls/2675","html_url":"https://github.com/gap-system/gap/pull/2675","diff_url":"https://github.com/gap-system/gap/pull/2675.diff","patch_url":"https://github.com/gap-system/gap/pull/2675.patch"},"body":"The Jupyter kernel for GAP uses `ViewString` for showing outputs.\r\nIn a terminal session, `ViewObj` is used for that.\r\nThe outputs of these two operations are different,\r\nmainly because several special `ViewObj` methods do not have\r\ncorresponding `StringObj` methods.\r\n\r\nOne way to achieve a better output in Jupyter notebooks is\r\nto add the missing `ViewString` methods.\r\nIn order to avoid code duplication, the individual `ViewObj` methods\r\ncan then be replaced by delegations to `ViewString`.\r\n\r\nThe new global function `DelegateFromViewObjToViewString`\r\ncan be installed for these delegations.\r\n\r\nNote:\r\n\r\n- Simply omitting the corresponding `ViewObj` methods would not be\r\n  appropriate.\r\n  There is a low rank `ViewObj` method that tries `ViewString`\r\n  (which is still ranked higher than `PrintObj`, the documented default\r\n  of `ViewObj`, which is not what one wants here),\r\n  but other applicable `ViewObj` methods may have higher rank.\r\n\r\n  (Some GAP script could be used to find out where this happens,\r\n  by checking the applicable `ViewObj` methods for individual methods\r\n  ranked above `DelegateFromViewObjToViewString`.\r\n  Where this does not happen, eventually the delegation could be removed.)\r\n\r\n- Delegating from `ViewObj` to `ViewString` slows `ViewObj` down,\r\n  already because of the additional objects that get created and later\r\n  have to be cleaned up; but I regard `ViewObj` as not time critical.\r\n\r\nHere is the list of changes from the current pull request:\r\n\r\n(Originally I had wanted to add only methods for ideals,\r\nbut the recursive structure of `ViewString` made it necessary\r\nto add more methods until the manual example tests ran without\r\ndifferences.)\r\n\r\n- added `ViewString` methods for the following structures:\r\n\r\n  `IsAbelianNumberField and IsCyclotomicCollection`,\r\n  `IsAlgebra`, `IsAlgebraWithOne`,\r\n  `IsCyclotomicField and IsCyclotomicCollection`, `IsFLMLOR`,\r\n  `IsFLMLORWithOne`, `IsLieAlgebra`, `IsMatrixGroup`,\r\n  `IsMatrix and IsFinite and IsGF2MatrixRep`, `IsPcGroup`, `IsPolynomialRing`,\r\n  `IsRightCoset`, `IsRing`, `IsRingWithOne`,\r\n  `IsRing and HasLeftActingRingOfIdeal and HasGeneratorsOfLeftIdeal`,\r\n  `IsRing and HasRightActingRingOfIdeal and HasGeneratorsOfRightIdeal`,\r\n  `IsRing and HasLeftActingRingOfIdeal and HasRightActingRingOfIdeal and\r\n  HasGeneratorsOfTwoSidedIdeal`,\r\n  `IsRowVector and IsFinite and IsGF2VectorRep`\r\n\r\n- replaced the corresponding `ViewObj` methods by the new global function\r\n  `DelegateFromViewObjToViewString`\r\n\r\n- replaced available `ViewObj` methods which called `ViewString`\r\n  by `DelegateFromViewObjToViewString`:\r\n\r\n  `IsCharacterTable`, `IsField and IsFFECollection`, `IsFloat`,\r\n  `IsFFE and IsCoeffsModConwayPolRep`, `IsGroup`,\r\n  `IsNaturalAlternatingGroup`, `IsNaturalSymmetricGroup`\r\n\r\n- for matrix groups, installed a `ViewString` method\r\n  with output different from what `ViewObj` showed:\r\n  Up to now, `Group([  ])` was printed for trivial matrix groups,\r\n  which does not make sense.\r\n\r\n- adjusted and added a few tests;\r\n  note that the manual examples contain already many places where the output\r\n  of `ViewObj` is (implicity) shown"},"comment":{"url":"https://api.github.com/repos/gap-system/gap/issues/comments/409974007","html_url":"https://github.com/gap-system/gap/pull/2675#issuecomment-409974007","issue_url":"https://api.github.com/repos/gap-system/gap/issues/2675","id":409974007,"node_id":"MDEyOklzc3VlQ29tbWVudDQwOTk3NDAwNw==","user":{"login":"ThomasBreuer","id":25204833,"node_id":"MDQ6VXNlcjI1MjA0ODMz","avatar_url":"https://avatars3.githubusercontent.com/u/25204833?v=4","gravatar_id":"","url":"https://api.github.com/users/ThomasBreuer","html_url":"https://github.com/ThomasBreuer","followers_url":"https://api.github.com/users/ThomasBreuer/followers","following_url":"https://api.github.com/users/ThomasBreuer/following{/other_user}","gists_url":"https://api.github.com/users/ThomasBreuer/gists{/gist_id}","starred_url":"https://api.github.com/users/ThomasBreuer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ThomasBreuer/subscriptions","organizations_url":"https://api.github.com/users/ThomasBreuer/orgs","repos_url":"https://api.github.com/users/ThomasBreuer/repos","events_url":"https://api.github.com/users/ThomasBreuer/events{/privacy}","received_events_url":"https://api.github.com/users/ThomasBreuer/received_events","type":"User","site_admin":false},"created_at":"2018-08-02T15:47:57Z","updated_at":"2018-08-02T15:47:57Z","author_association":"CONTRIBUTOR","body":"@ChrisJefferson :\r\nGood idea.\r\nPerhaps `InstallViewStringAndViewObjMethod` would be a better alternative\r\nto my global `DelegateFromViewObjToViewString`.\r\nOne advantage of `DelegateFromViewObjToViewString` is that we can already now\r\nreduce the number of `ViewObj` methods, by installing just one delegation\r\nfor the algebraic structure in question,\r\nand then have different `ViewString` methods for the various situations (with or without\r\nknown values of `Size`, `Dimension`, or the relevant generators, etc.).\r\n\r\nNowadays, I would anyhow prefer to have only one method for these situations.\r\nI think that at the time when the current code was written,\r\nwe were (mis)using the method selection just for avoiding `if` statements\r\n--once one gets a nice new tool one tends to use it as often as possible."}}
{"actor":{"display_login":"ThomasBreuer"}}