provide facility to bind element names

This commit is contained in:
Glen Whitney 2017-10-19 02:08:47 +02:00
parent 88533fd7de
commit 87e7b01333

View File

@ -254,6 +254,30 @@ function( Q, name )
F := FamilyObj( Representative( Q ) ); F := FamilyObj( Representative( Q ) );
F!.elmNamePrefix := name; F!.elmNamePrefix := name;
end); end);
#############################################################################
##
#O BindElmNames( M )
##
## For each element e of the magma <M>, binds the identifier named String(e)
## to e.
## collection <C>. For quasigroups, loops, and possibly related structures
## this changes the prefix with which the elements of that family are printed.
InstallMethod( BindElmNames, "for a magma",
[ IsMagma ],
function( M )
local e, nm;
for e in Elements(M) do
nm := String(e);
BindGlobal(nm, e);
MakeReadWriteGlobal(nm);
od;
return;
end);
F := FamilyObj( Representative( Q ) );
F!.elmNamePrefix := name;
end);
############################################################################# #############################################################################
## ##