From 88533fd7de3f247a3203d26eb5ebdad9e54f2fd7 Mon Sep 17 00:00:00 2001 From: Glen Whitney Date: Thu, 19 Oct 2017 01:11:26 +0200 Subject: [PATCH] extend the element naming prefix to more general setting, and so use more elaborate identifier --- gap/elements.gi | 4 ++-- gap/quasigroups.gd | 5 +++-- gap/quasigroups.gi | 22 ++++++++++++---------- 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/gap/elements.gi b/gap/elements.gi index 5ecd166..2fdb0a1 100644 --- a/gap/elements.gi +++ b/gap/elements.gi @@ -17,7 +17,7 @@ InstallMethod( PrintObj, "for a quasigroup element", function( obj ) local F; F := FamilyObj( obj ); - Print( F!.names, obj![ 1 ] ); + Print( F!.elmNamePrefix, obj![ 1 ] ); end ); InstallMethod( PrintObj, "for a loop element", @@ -25,7 +25,7 @@ InstallMethod( PrintObj, "for a loop element", function( obj ) local F; F := FamilyObj( obj ); - Print( F!.names, obj![ 1 ] ); + Print( F!.elmNamePrefix, obj![ 1 ] ); end ); InstallMethod( \=, "for two elements of a quasigroup", diff --git a/gap/quasigroups.gd b/gap/quasigroups.gd index aee54d3..aa161a6 100644 --- a/gap/quasigroups.gd +++ b/gap/quasigroups.gd @@ -99,8 +99,9 @@ DeclareOperation( "NormalizedQuasigroupTable", [ IsMatrix ] ); DeclareAttribute( "CayleyTable", IsMagma ); DeclareOperation( "QuasigroupByCayleyTable", [ IsMatrix ] ); DeclareOperation( "LoopByCayleyTable", [ IsMatrix ] ); -DeclareOperation( "SetQuasigroupElmName", [ IsQuasigroup, IsString ] ); -DeclareSynonym( "SetLoopElmName", SetQuasigroupElmName ); +DeclareOperation( "SpecifyElmNamePrefix", [ IsCollection, IsString ] ); +DeclareSynonym( "SetQuasigroupElmName", SpecifyElmNamePrefix ); +DeclareSynonym( "SetLoopElmName", SpecifyElmNamePrefix ); DeclareAttribute( "ConstructorFromTable", IsMagma ); DeclareOperation( "CanonicalCopy", [ IsMagma ] ); diff --git a/gap/quasigroups.gi b/gap/quasigroups.gi index 2414579..54df1f6 100644 --- a/gap/quasigroups.gi +++ b/gap/quasigroups.gi @@ -187,7 +187,7 @@ function( ct ) NewType( F, IsQuasigroupElement and IsQuasigroupElmRep), [ i ] ) ) ); F!.set := elms; F!.cayleyTable := ct; - F!.names := "q"; + F!.elmNamePrefix := "q"; # creating the quasigroup Q := Objectify( NewType( FamilyObj( elms ), IsQuasigroup and IsAttributeStoringRep ), rec() ); @@ -196,7 +196,7 @@ function( ct ) SetAsSSortedList( Q, elms ); SetParent( Q, Q ); SetCayleyTable( Q, ct ); - SetConstructorFromTable(QuasigroupByCayleyTable); + SetConstructorFromTable(Q, QuasigroupByCayleyTable); return Q; end ); @@ -225,7 +225,7 @@ function( ct ) NewType( F, IsLoopElement and IsLoopElmRep), [ i ] ) ) ); F!.set := elms; F!.cayleyTable := ct; - F!.names := "l"; + F!.elmNamePrefix := "l"; # creating the loop L := Objectify( NewType( FamilyObj( elms ), IsLoop and IsAttributeStoringRep ), rec() ); @@ -235,22 +235,24 @@ function( ct ) SetParent( L, L ); SetCayleyTable( L, ct ); SetOne( L, elms[ 1 ] ); - SetConstructorFromTable(LoopByCayleyTable); + SetConstructorFromTable(L, LoopByCayleyTable); return L; end ); ############################################################################# ## -#O SetQuasigroupElmName( Q, name ) +#O SpecifyElmNamePrefix( C, name ) ## -## Changes the name of elements of quasigroup or loop to +## Sets the elmNamePrefix property on the family of a Represntative of +## collection . For quasigroups, loops, and possibly related structures +## this changes the prefix with which the elements of that family are printed. -InstallMethod( SetQuasigroupElmName, "for quasigroup and string", - [ IsQuasigroup, IsString ], +InstallMethod( SpecifyElmNamePrefix, "for collection and string", + [ IsCollection, IsString ], function( Q, name ) local F; - F := FamilyObj( Elements( Q )[ 1 ] ); - F!.names := name; + F := FamilyObj( Representative( Q ) ); + F!.elmNamePrefix := name; end); #############################################################################