Skip to content

Commit

Permalink
Fix whitespace in a few documentation examples
Browse files Browse the repository at this point in the history
We recently removed a ton of trailing whitespace; but in some cases,
these have meaning, such as in .tst files or inside `<Example>` elements
after "empty" prompts such as `gap> ` or `> ` or `brk> `
  • Loading branch information
fingolfin committed Dec 14, 2022
1 parent f021922 commit cd51b34
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 50 deletions.
1 change: 0 additions & 1 deletion doc/ref/create.xml
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,6 @@ gap> e2 := ShallowCopy(e);
(2,3,4), (1,4,2,3), (1,2,3), (1,3)(2,4), (3,4), (1,4,3), (1,2,4,3),
(1,3), (2,4,3), (1,4,3,2), (1,2)(3,4), (1,3,2), (2,3), (1,4)(2,3),
(1,2,3,4), (1,3,2,4) ]
gap>
]]></Example>
<P/>
There are two other related functions:
Expand Down
6 changes: 3 additions & 3 deletions doc/ref/mloop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ variable should have to continue the computation.
<Log><![CDATA[
brk> return 9; # we had tried to enter the divisor 9 but typed 0 ...
1/9
gap>
gap>
]]></Log>

</Subsection>
Expand Down Expand Up @@ -632,15 +632,15 @@ gap> ErrorNoTraceBack := function(arg) # arg is special variable that GAP
> # knows to treat as list of arg's
> local SavedOnBreak, ENTBOnBreak;
> SavedOnBreak := OnBreak; # save current value of OnBreak
>
>
> ENTBOnBreak := function() # our `local' OnBreak
> local s;
> for s in arg do
> Print(s);
> od;
> OnBreak := SavedOnBreak; # restore OnBreak afterwards
> end;
>
>
> OnBreak := ENTBOnBreak;
> Error();
> end;
Expand Down
2 changes: 1 addition & 1 deletion doc/ref/options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ gap> foo( : myopt1, myopt2 := [Z(3),"aardvark"]);
myopt1 = true myopt2 = [ Z(3), "aardvark" ]
gap> DisplayOptionsStack();
[ ]
gap>
gap>
]]></Example>

</Section>
Expand Down
86 changes: 43 additions & 43 deletions doc/ref/xtndxmpl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ gap> resclass_sum := function( c1, c2 )
> if c1[2] <> c2[2] then Error( "different moduli" ); fi;
> return [ ( c1[1] + c2[1] ) mod c1[2], c1[2] ];
> end;;
gap>
gap>
gap> resclass_diff := function( c1, c2 )
> if c1[2] <> c2[2] then Error( "different moduli" ); fi;
> return [ ( c1[1] - c2[1] ) mod c1[2], c1[2] ];
> end;;
gap>
gap>
gap> resclass_prod := function( c1, c2 )
> if c1[2] <> c2[2] then Error( "different moduli" ); fi;
> return [ ( c1[1] * c2[1] ) mod c1[2], c1[2] ];
> end;;
gap>
gap>
gap> resclass_quo := function( c1, c2 )
> local quo;
> if c1[2] <> c2[2] then Error( "different moduli" ); fi;
Expand Down Expand Up @@ -338,26 +338,26 @@ see&nbsp;<Ref Sect="Declaration and Implementation Part"/>).
<P/>
<Example><![CDATA[
gap> DeclareGlobalFunction( "MyZmodnZ" );
gap>
gap>
gap> InstallGlobalFunction( MyZmodnZ, function( n )
> local F, R;
>
>
> if not IsPosInt( n ) then
> Error( "<n> must be a positive integer" );
> fi;
>
>
> # Construct the family of element objects of our ring.
> F:= NewFamily( Concatenation( "MyZmod", String( n ), "Z" ),
> IsMyZmodnZObj );
>
>
> # Install the data.
> F!.modulus:= n;
>
>
> # Make the domain.
> R:= RingWithOneByGenerators( [ MyZmodnZObj( F, 1 ) ] );
> SetIsWholeFamily( R, true );
> SetName( R, Concatenation( "(Integers mod ", String(n), ")" ) );
>
>
> # Return the ring.
> return R;
> end );
Expand Down Expand Up @@ -493,7 +493,7 @@ gap> InstallMethod( \=,
> IsIdenticalObj,
> [IsMyZmodnZObj and IsMyModulusRep, IsMyZmodnZObj and IsMyModulusRep],
> function( x, y ) return x![1] = y![1]; end );
gap>
gap>
gap> InstallMethod( \<,
> "for two elements in Z/nZ (ModulusRep)",
> IsIdenticalObj,
Expand Down Expand Up @@ -536,12 +536,12 @@ gap> InstallMethod( \+,
> function( x, y )
> return MyZmodnZObj( FamilyObj( x ), x![1] + y![1] );
> end );
gap>
gap>
gap> InstallMethod( ZeroOp,
> "for element in Z/nZ (ModulusRep)",
> [ IsMyZmodnZObj ],
> x -> MyZmodnZObj( FamilyObj( x ), 0 ) );
gap>
gap>
gap> InstallMethod( AdditiveInverseOp,
> "for element in Z/nZ (ModulusRep)",
> [ IsMyZmodnZObj and IsMyModulusRep ],
Expand Down Expand Up @@ -608,7 +608,7 @@ gap> InstallMethod( \+,
> function( x, y )
> return MyZmodnZObj( FamilyObj( x ), x![1] + y );
> end );
gap>
gap>
gap> InstallMethod( \+,
> "for integer and element in Z/nZ (ModulusRep)",
> [ IsInt, IsMyZmodnZObj and IsMyModulusRep ],
Expand Down Expand Up @@ -645,12 +645,12 @@ gap> InstallMethod( \*,
> function( x, y )
> return MyZmodnZObj( FamilyObj( x ), x![1] * y![1] );
> end );
gap>
gap>
gap> InstallMethod( OneOp,
> "for element in Z/nZ (ModulusRep)",
> [ IsMyZmodnZObj ],
> elm -> MyZmodnZObj( FamilyObj( elm ), 1 ) );
gap>
gap>
gap> InstallMethod( InverseOp,
> "for element in Z/nZ (ModulusRep)",
> [ IsMyZmodnZObj and IsMyModulusRep ],
Expand Down Expand Up @@ -743,7 +743,7 @@ gap> InstallMethod( PrintObj,
> Print( "(Integers mod ",
> ElementsFamily( FamilyObj(R) )!.modulus, ")" );
> end );
gap>
gap>
gap> InstallMethod( \mod,
> "for `Integers', and a positive integer",
> [ IsIntegers, IsPosRat and IsInt ],
Expand Down Expand Up @@ -814,7 +814,7 @@ gap> InstallMethod( InverseOp,
> and CategoryCollections( CategoryCollections( IsMyZmodnZObj ) ) ],
> function( mat )
> local one, modulus;
>
>
> one:= One( mat[1][1] );
> modulus:= FamilyObj( one )!.modulus;
> mat:= InverseOp( List( mat, row -> List( row, Int ) ) );
Expand Down Expand Up @@ -917,12 +917,12 @@ gap> InstallMethod( Random,
> [ CategoryCollections( IsMyZmodnZObj ) and IsWholeFamily ],
> R -> MyZmodnZObj( ElementsFamily( FamilyObj(R) ),
> Random( 0, Size( R ) - 1 ) ) );
gap>
gap>
gap> InstallMethod( Size,
> "for full ring Z/nZ",
> [ CategoryCollections( IsMyZmodnZObj ) and IsWholeFamily ],
> R -> ElementsFamily( FamilyObj(R) )!.modulus );
gap>
gap>
gap> InstallMethod( Units,
> "for full ring Z/nZ",
> [ CategoryCollections( IsMyZmodnZObj )
Expand All @@ -948,7 +948,7 @@ gap> InstallMethod( Units,
> and IsWholeFamily and IsRing ],
> function( R )
> local G, gens;
>
>
> gens:= GeneratorsPrimeResidues( Size( R ) ).generators;
> if not IsEmpty( gens ) and gens[ 1 ] = 1 then
> gens:= gens{ [ 2 .. Length( gens ) ] };
Expand Down Expand Up @@ -1032,15 +1032,15 @@ the ones we want.)
<P/>
<Log><![CDATA[
gap> DeclareCategory( "IsMyZmodnZObj", IsScalar );
gap>
gap>
gap> DeclareCategory( "IsMyZmodnZObjNonprime", IsMyZmodnZObj );
gap>
gap>
gap> DeclareSynonym( "IsMyZmodpZObj", IsMyZmodnZObj and IsFFE );
gap>
gap>
gap> DeclareRepresentation( "IsMyModulusRep", IsPositionalObjectRep, [ 1 ] );
gap>
gap>
gap> DeclareGlobalFunction( "MyZmodnZObj" );
gap>
gap>
gap> DeclareGlobalFunction( "MyZmodnZ" );
]]></Log>
<P/>
Expand Down Expand Up @@ -1079,7 +1079,7 @@ gap> InstallGlobalFunction( MyZmodnZObj, function( Fam, residue )
gap> InstallGlobalFunction( MyZmodnZ, function( n )
> local F, R;
>
>
> if not ( IsInt( n ) and IsPosRat( n ) ) then
> Error( "<n> must be a positive integer" );
> elif IsPrimeInt( n ) then
Expand All @@ -1099,7 +1099,7 @@ gap> InstallGlobalFunction( MyZmodnZ, function( n )
> SetIsWholeFamily( R, true );
> SetName( R, Concatenation( "(Integers mod ",String(n),")" ) );
> fi;
>
>
> # Return the ring resp. field.
> return R;
> end );
Expand All @@ -1123,14 +1123,14 @@ gap> InstallMethod( PrintObj,
> function( x )
> Print( "( ", x![1], " mod ", FamilyObj(x)!.modulus, " )" );
> end );
gap>
gap>
gap> InstallMethod( PrintObj,
> "for element in Z/pZ (ModulusRep)",
> [ IsMyZmodpZObj and IsMyModulusRep ],
> function( x )
> Print( "( ", x![1], " mod ", Characteristic(x), " )" );
> end );
gap>
gap>
gap> InstallMethod( \=,
> "for two elements in Z/nZ (ModulusRep)",
> IsIdenticalObj,
Expand All @@ -1153,7 +1153,7 @@ gap> InstallMethod( \=,
> function( x, y )
> return DegreeFFE( y ) = 1 and x![1] = IntFFE( y );
> end );
gap>
gap>
gap> InstallMethod( \=,
> "for internal FFE and element in Z/pZ (ModulusRep)",
> IsIdenticalObj,
Expand Down Expand Up @@ -1183,7 +1183,7 @@ gap> InstallMethod( \<,
> [ IsMyZmodnZObjNonprime and IsMyModulusRep,
> IsMyZmodnZObjNonprime and IsMyModulusRep ],
> function( x, y ) return x![1] < y![1]; end );
gap>
gap>
gap> InstallMethod( \<,
> "for two elements in Z/pZ (ModulusRep)",
> IsIdenticalObj,
Expand All @@ -1201,15 +1201,15 @@ gap> InstallMethod( \<,
> return LogMod( x![1], r, p ) < LogMod( y![1], r, p );
> fi;
> end );
gap>
gap>
gap> InstallMethod( \<,
> "for element in Z/pZ (ModulusRep) and internal FFE",
> IsIdenticalObj,
> [ IsMyZmodpZObj and IsMyModulusRep, IsFFE and IsInternalRep ],
> function( x, y )
> return x![1] * One( y ) < y;
> end );
gap>
gap>
gap> InstallMethod( \<,
> "for internal FFE and element in Z/pZ (ModulusRep)",
> IsIdenticalObj,
Expand Down Expand Up @@ -1247,25 +1247,25 @@ gap> InstallMethod( \+,
> IsIdenticalObj,
> [ IsMyZmodpZObj and IsMyModulusRep, IsFFE and IsInternalRep ],
> function( x, y ) return x![1] + y; end );
gap>
gap>
gap> InstallMethod( \+,
> "for internal FFE and element in Z/pZ (ModulusRep)",
> IsIdenticalObj,
> [ IsFFE and IsInternalRep, IsMyZmodpZObj and IsMyModulusRep ],
> function( x, y ) return x + y![1]; end );
gap>
gap>
gap> InstallMethod( \*,
> "for element in Z/pZ (ModulusRep) and internal FFE",
> IsIdenticalObj,
> [ IsMyZmodpZObj and IsMyModulusRep, IsFFE and IsInternalRep ],
> function( x, y ) return x![1] * y; end );
gap>
gap>
gap> InstallMethod( \*,
> "for internal FFE and element in Z/pZ (ModulusRep)",
> IsIdenticalObj,
> [ IsFFE and IsInternalRep, IsMyZmodpZObj and IsMyModulusRep ],
> function( x, y ) return x * y![1]; end );
gap>
gap>
gap> InstallMethod( InverseOp,
> "for element in Z/nZ (ModulusRep, nonprime)",
> [ IsMyZmodnZObjNonprime and IsMyModulusRep ],
Expand All @@ -1277,7 +1277,7 @@ gap> InstallMethod( InverseOp,
> fi;
> return residue;
> end );
gap>
gap>
gap> InstallMethod( InverseOp,
> "for element in Z/pZ (ModulusRep)",
> [ IsMyZmodpZObj and IsMyModulusRep ],
Expand Down Expand Up @@ -1323,33 +1323,33 @@ gap> InstallMethod( Enumerator,
> F:= ElementsFamily( FamilyObj( R ) );
> return List( [ 0 .. Size( R ) - 1 ], x -> MyZmodnZObj( F, x ) );
> end );
gap>
gap>
gap> InstallMethod( Random,
> "for full ring Z/nZ",
> [ CategoryCollections( IsMyZmodnZObjNonprime ) and IsWholeFamily ],
> R -> MyZmodnZObj( ElementsFamily( FamilyObj( R ) ),
> Random( 0, Size( R ) - 1 ) ) );
gap>
gap>
gap> InstallMethod( Size,
> "for full ring Z/nZ",
> [ CategoryCollections( IsMyZmodnZObjNonprime ) and IsWholeFamily ],
> R -> ElementsFamily( FamilyObj( R ) )!.modulus );
gap>
gap>
gap> InstallMethod( Units,
> "for full ring Z/nZ",
> [ CategoryCollections( IsMyZmodnZObjNonprime )
> and IsWholeFamily and IsRing ],
> function( R )
> local G, gens;
>
>
> gens:= GeneratorsPrimeResidues( Size( R ) ).generators;
> if not IsEmpty( gens ) and gens[ 1 ] = 1 then
> gens:= gens{ [ 2 .. Length( gens ) ] };
> fi;
> gens:= Flat( gens ) * One( R );
> return GroupByGenerators( gens, One( R ) );
> end );
gap>
gap>
gap> InstallTrueMethod( IsFinite,
> CategoryCollections( IsMyZmodnZObjNonprime ) and IsDomain );
]]></Log>
Expand Down
4 changes: 2 additions & 2 deletions doc/tut/introduc.xml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ more command line options are described in
Section&nbsp;<Ref Sect="Command Line Options" BookName="ref"/>.)
<P/>
<Example><![CDATA[
gap>
gap>
]]></Example>
<P/>
The usual way to end a &GAP; session is to type <C>quit;</C> at the <C>gap></C>
Expand Down Expand Up @@ -176,7 +176,7 @@ symbols followed by <C>;</C> and <B>Return</B>.
<Example><![CDATA[
gap> (9 - 7) * (5 + 6);
22
gap>
gap>
]]></Example>
<P/>
Then &GAP; echoes the result 22 on the next line and shows with the
Expand Down

0 comments on commit cd51b34

Please sign in to comment.