Skip to content

Commit

Permalink
lib: add PrintObj method for general domains ...
Browse files Browse the repository at this point in the history
... which know their GeneratorsOfDomain.

Adds tests and updates examples in the manual.
  • Loading branch information
ssiccha committed May 26, 2019
1 parent 4437e09 commit af56913
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
12 changes: 12 additions & 0 deletions lib/domain.gi
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ InstallMethod( GeneratorsOfDomain,
AsList );


#############################################################################
##
## PrintObj
##
InstallMethod( PrintObj,
"for a domain with GeneratorsOfDomain",
[ HasGeneratorsOfDomain and IsDomain ],
function( dom )
Print( "Domain(", GeneratorsOfDomain( dom ), ")" );
end );


#############################################################################
##
#M AsList( <D> ) . . . . . . . . . . . . . . . list of elements of a domain
Expand Down
8 changes: 4 additions & 4 deletions lib/relation.gd
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ DeclareGlobalFunction("RandomBinaryRelationOnPoints");
## <A>domain</A>.
## <Example><![CDATA[
## gap> IdentityBinaryRelation(5);
## <equivalence relation on <object> >
## <equivalence relation on Domain([ 1 .. 5 ]) >
## gap> s4:=SymmetricGroup(4);
## Sym( [ 1 .. 4 ] )
## gap> IdentityBinaryRelation(s4);
Expand All @@ -171,7 +171,7 @@ DeclareGlobalFunction("IdentityBinaryRelation");
## where the source and range are the same set.
## <Example><![CDATA[
## gap> r:=BinaryRelationByElements(Domain([1..3]),[Tuple([1,2]),Tuple([1,3])]);
## <general mapping: <object> -> <object> >
## <general mapping: Domain([ 1 .. 3 ]) -> Domain([ 1 .. 3 ]) >
## ]]></Example>
## </Description>
## </ManSection>
Expand Down Expand Up @@ -794,7 +794,7 @@ DeclareAttribute("GeneratorsOfEquivalenceRelationPartition",
## they contain only elements of the domain.
## <Example><![CDATA[
## gap> er:=EquivalenceRelationByPartition(Domain([1..10]),[[1,3,5,7,9],[2,4,6,8,10]]);
## <equivalence relation on <object> >
## <equivalence relation on Domain([ 1 .. 10 ]) >
## gap> IsEquivalenceRelation(er);
## true
## ]]></Example>
Expand Down Expand Up @@ -932,7 +932,7 @@ DeclareAttribute("EquivalenceClassRelation", IsEquivalenceClass);
## </M><C>EquivalenceClasses</C><M>( c2 )</M>.
## <Example><![CDATA[
## gap> er:=EquivalenceRelationByPartition(Domain([1..10]),[[1,3,5,7,9],[2,4,6,8,10]]);
## <equivalence relation on <object> >
## <equivalence relation on Domain([ 1 .. 10 ]) >
## gap> classes := EquivalenceClasses(er);
## [ {1}, {2} ]
## ]]></Example>
Expand Down
6 changes: 6 additions & 0 deletions tst/testinstall/domain.tst
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,11 @@ false
gap> M = J;
Error, no method found for comparing two infinite domains

# PrintObj method
gap> Domain([1..5]);
Domain([ 1 .. 5 ])
gap> Domain(FamilyObj(1), []);
Domain([ ])

#
gap> STOP_TEST("domain.tst");

0 comments on commit af56913

Please sign in to comment.