diff --git a/CHANGES.md b/CHANGES.md index 9a5387c..06b0f30 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -17,6 +17,7 @@ restriction from every `Size` and `Order` argument - Fix `AllPrimitiveGroups` and friends to honour every `NrMovedPoints` argument, not just the first one + - Fix `ShallowCopy` and `List` for `PrimitiveGroupsIterator` - Fix the dimension in the names of PrimitiveGroup(1057,1) and (1057,2) - Fix 29 socle types recorded with a rank one too high - Fix the corrupted name of PrimitiveGroup(625,657) diff --git a/lib/primitiv.gi b/lib/primitiv.gi index fd96c44..03ec221 100644 --- a/lib/primitiv.gi +++ b/lib/primitiv.gi @@ -1206,6 +1206,23 @@ local g; return g; end); +# needed by List, which iterates over a copy; the components are either +# immutable or replaced, never changed in place, so copying them suffices +InstallMethod(ShallowCopy,"primitive groups iterator",true, + [IsPrimGrpIterRep and IsIterator],0, +function(it) +local new; + new:=Objectify(NewType(IteratorsFamily, + IsIterator and IsPrimGrpIterRep and IsMutable),rec()); + new!.deg:=it!.deg; + new!.degi:=it!.degi; + new!.nr:=it!.nr; + new!.prop:=it!.prop; + new!.gut:=it!.gut; + new!.next:=it!.next; + return new; +end); + ############################################################################# ## #F AllPrimitiveGroups( , , ... ) . . . . . . . selection function diff --git a/tst/testinstall/bugfix.tst b/tst/testinstall/bugfix.tst index 2aa5dda..939dbd3 100644 --- a/tst/testinstall/bugfix.tst +++ b/tst/testinstall/bugfix.tst @@ -250,5 +250,21 @@ true gap> PRIMGRP_EntryFromDescription(["NoSuchThing"], 6, 1); Error, unknown construction "NoSuchThing" for entry 1 of degree 6 +# List on an iterator works on a ShallowCopy of it, which must advance +# independently of the original. +# See +gap> it := PrimitiveGroupsIterator(NrMovedPoints, 5);; +gap> NextIterator(it); +C(5) +gap> List(it); +[ D(2*5), AGL(1, 5), A(5), S(5) ] +gap> copy := ShallowCopy(it);; +gap> [ NextIterator(copy), NextIterator(copy) ]; +[ D(2*5), AGL(1, 5) ] +gap> NextIterator(it); +D(2*5) +gap> List(PrimitiveGroupsIterator(NrMovedPoints, 5, IsSolvable, false)); +[ A(5), S(5) ] + # gap> STOP_TEST("bugfix.tst", 1);