Skip to content

Commit

Permalink
Avoid trivial function wrappers (#5560)
Browse files Browse the repository at this point in the history
That is, use 'f' instead of 'x -> f(x)' and so on
  • Loading branch information
fingolfin committed Jan 6, 2024
1 parent 5d42089 commit 7d5e974
Show file tree
Hide file tree
Showing 29 changed files with 51 additions and 52 deletions.
4 changes: 2 additions & 2 deletions benchmark/transgrp/examine4
Original file line number Diff line number Diff line change
Expand Up @@ -2868,7 +2868,7 @@ local b,w,a;
return [t];
fi;
b:=List(sys.emb,i->Image(i,c));
b:=Subgroup(sys.parent,Concatenation(List(b,i->GeneratorsOfGroup(i))));
b:=Subgroup(sys.parent,Concatenation(List(b,GeneratorsOfGroup)));
w:=Subgroup(sys.parent,Concatenation(GeneratorsOfGroup(b),
GeneratorsOfGroup(t)));

Expand All @@ -2895,7 +2895,7 @@ local b,w,a,fno,cnt,normalsyl,tf,nt,tno,ntno,i,j,k,com,hom,cs,ker,nf;
return [t];
fi;
b:=List(sys.emb,i->Image(i,c));
b:=Subgroup(sys.parent,Concatenation(List(b,i->GeneratorsOfGroup(i))));
b:=Subgroup(sys.parent,Concatenation(List(b,GeneratorsOfGroup)));
w:=Subgroup(sys.parent,Concatenation(GeneratorsOfGroup(b),
GeneratorsOfGroup(t)));
fno:=Normalizer(Image(sys.blockhom,sys.kr),Image(sys.blockhom,w));
Expand Down
2 changes: 1 addition & 1 deletion lib/alglie.gi
Original file line number Diff line number Diff line change
Expand Up @@ -3970,7 +3970,7 @@ InstallMethod( NormalizedElementOfMagmaRingModuloRelations,
# wrap the list `todo' into an element of the free Lie algebra.

todo:= List( todo, x -> [x[3],x[2]] );
Sort( todo, function( x, y) return x < y; end );
Sort( todo, \< );
tlist:= [];
for i in [1..Length(todo)] do
Append( tlist, todo[i] );
Expand Down
4 changes: 2 additions & 2 deletions lib/algrep.gi
Original file line number Diff line number Diff line change
Expand Up @@ -3407,7 +3407,7 @@ InstallHandlingByNiceBasis( "IsDirectSumElementsSpace", rec(
ev:= ShallowCopy( vec![1] );
fam:= ElementsFamily( FamilyObj( V ) );
mods:= fam!.constituentModules;
u:= List( mods, x -> Zero( x ) );
u:= List( mods, Zero );
d:= 0;
k:= 1;
i:= 1;
Expand Down Expand Up @@ -3472,7 +3472,7 @@ InstallMethod( DirectSumOfAlgebraModules,
fam!.niceVectorFam:= niceVF;

gens:= [ ];
zero:= List( list, x -> Zero( x ) );
zero:= List( list, Zero );
for i in [1..Length(list)] do
gV:= Basis( list[i] );
for v in gV do
Expand Down
2 changes: 1 addition & 1 deletion lib/ctblgrp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1765,7 +1765,7 @@ local often,trans,e,neu,i,inv,cent,l,s,s1,x,dom;
Add(trans,Orbit(cent,e));
fi;
od;
often:=List(trans,i->Length(i));
often:=List(trans,Length);
return [List(trans,i->i[1]),often];
else
#Info(InfoCharacterTable,3,"using DoubleCosets;");
Expand Down
2 changes: 1 addition & 1 deletion lib/dicthf.gi
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ InstallMethod(SparseIntKey,"for lists of vectors",true,
[ IsFFECollColl,IsObject ], 0,
function(m,v)
local f;
if not (IsList(m) and IS_PLIST_REP(m) and ForAll(m,i->IsRowVector(i))) then
if not (IsList(m) and IS_PLIST_REP(m) and ForAll(m,IsRowVector)) then
TryNextMethod();
fi;
f:=DefaultFieldOfMatrix(m);
Expand Down
2 changes: 1 addition & 1 deletion lib/fitfree.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ local s,o,a,n,d,f,fn,j,b,i;
n:=Filtered(NormalSubgroups(i),x->Size(x)>1);
# if G is not fitting-free it has a proper normal subgroup of
# prime-power order
if ForAny(n,x->IsPGroup(x)) then
if ForAny(n,IsPGroup) then
return fail;
fi;
n:=Filtered(n,IsNonabelianSimpleGroup);
Expand Down
2 changes: 1 addition & 1 deletion lib/ghomfp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1070,7 +1070,7 @@ local m,s,g,i,j,gen,img,hom,d,pos;

# since f is the full group, exponent sums are with respect to its
# generators.
m:=List(RelatorsOfFpGroup(f),w->ExponentSums(w));
m:=List(RelatorsOfFpGroup(f),ExponentSums);

if Length(m)>0 then
m:=ReducedRelationMat(m);
Expand Down
6 changes: 3 additions & 3 deletions lib/gpfpiso.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2306,7 +2306,7 @@ if rule[1]=rule[2] then return;fi;
for i in Pcgs(ha) do
a:=[weylword(i),borelword(i)];
Info(InfoFpGroup,2,"intersection:",a);
a:=List(a,x->trawou(x));
a:=List(a,trawou);
addrule(a);
od;
b:=IsomorphismFpMonoid(weyl!.epiweyl);
Expand Down Expand Up @@ -2380,7 +2380,7 @@ if rule[1]=rule[2] then return;fi;
b:=borelword(j);
k:=borelword(k);
a:=[b*a,a*k];
a:=List(a,x->trawou(x));
a:=List(a,trawou);
addrule(a);
else
Add(noncomm[i],jj);
Expand Down Expand Up @@ -2487,7 +2487,7 @@ if rule[1]=rule[2] then return;fi;
k[i]:=Intersection(k[i],[-QuoInt(pri[i],2)..QuoInt(pri[i],2)]);
k[i]:=List(k[i],x->a[i]^x);
od;
borelelm:=Set(Cartesian(k),x->Product(x));
borelelm:=Set(Cartesian(k),Product);

fi;

Expand Down
4 changes: 2 additions & 2 deletions lib/gpprmsya.gi
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ local schreiertree, cosetrepresentative, flag, schtree, stab, k, p, j,
stab:=Group(stab);

orbits:=Orbits(stab,dom{[1..Binomial(n,l2)^l1]},OnPoints);
k:=Position(List(orbits, x->Length(x)),l1*l2*(n-l2));
k:=Position(List(orbits, Length),l1*l2*(n-l2));
if k = fail then
flag:= false;
else
Expand Down Expand Up @@ -2460,7 +2460,7 @@ local G,max,dom,n,A,S,issn,p,i,j,m,k,powdec,pd,gps,v,invol,sel,mf,l,prim;
k:=CallFuncList(ValueGlobal("AllPrimitiveGroups"),
[NrMovedPoints,n,SocleTypePrimitiveGroup,
SocleTypePrimitiveGroup(m),SignPermGroup,-1]);
k:=List(k,i->AlternatingSubgroup(i));
k:=List(k,AlternatingSubgroup);
if ForAll(k,j->not IsTransitive(j,[1..n]) or not IsPrimitive(j,[1..n])
or PrimitiveIdentification(j)<>PrimitiveIdentification(m)) then
Add(max,m^invol);
Expand Down
2 changes: 1 addition & 1 deletion lib/gprd.gi
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ function( D )

list := DirectProductInfo( D ).groups;

if ForAll (list, G -> IsPGroup(G)) then
if ForAll(list, IsPGroup) then
p := fail;
for G in list do
if not IsTrivial (G) then
Expand Down
2 changes: 1 addition & 1 deletion lib/groebner.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,7 @@ local ord,b,ind,num,c,corners,i,j,a,rem,bound,mon,n,monb,dim,sc,k,l,char,hom;
Add(corners,a); # extra corner
fi;
od;
if not ForAll(bound,x->IsInt(x)) then
if not ForAll(bound,IsInt) then
Info(InfoWarning,1,"quotient ring has infinite dimension");
TryNextMethod();
fi;
Expand Down
2 changes: 1 addition & 1 deletion lib/grpfp.gi
Original file line number Diff line number Diff line change
Expand Up @@ -2070,7 +2070,7 @@ local ind,q,is;
ind:=List(l,IndexInWholeGroup);
Print("Found ",Length(l)," subgroups, core indices:\n",Collected(ind),"\n");
l:=List(Set(ind),y->Filtered(l,x->IndexInWholeGroup(x)=y));
l:=List(l,x->Intersection(x));
l:=List(l,Intersection);
SortBy(l,IndexInWholeGroup);
if Length(l)=1 then
is:=l[1];
Expand Down
2 changes: 1 addition & 1 deletion lib/grplatt.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ InstallGlobalFunction(LatticeViaRadical,function(arg)
if not k in nts then Add(nts,k);fi;
od;
od;
SortBy(nts,x->Size(x)); # increasing order
SortBy(nts,Size); # increasing order
# by setting up `act' as fail, we force a different selection later
act:=[nts,fail];

Expand Down
2 changes: 1 addition & 1 deletion lib/grppcaut.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1619,7 +1619,7 @@ InstallGlobalFunction(AutomorphismGroupNilpotentGroup,function(G)
autS := List(S, AutomorphismGroup);

# Compute automorphism group for G from this
gens := Concatenation(List(S, P->Pcgs(P)));
gens := Concatenation(List(S, Pcgs));
off := 0;
gensAutG := [];
for i in [1..Length(S)] do
Expand Down
10 changes: 5 additions & 5 deletions lib/grppclat.gi
Original file line number Diff line number Diff line change
Expand Up @@ -452,11 +452,11 @@ local P,g,op,act,a,pcgs,ma,mat,d,f,i,j,new,newmat,id,p,dodim,compldim,compl,
#a:=SubgroupNC(Parent(g),List(i,j->Product([1..d],k->pcgs[k]^j[k])));
asz:=kersz*p^Length(i);
if kersz=1 then
a:=SubgroupNC(par,List(i,j->pcelm(j)));
a:=SubgroupNC(par,List(i,pcelm));
else
#a:=ClosureSubgroup(ker,List(i,j->pcelm(j)):knownClosureSize:=asz);
#a:=ClosureSubgroup(ker,List(i,pcelm):knownClosureSize:=asz);
a:=SubgroupNC(par,Concatenation(GeneratorsOfGroup(ker),
List(i,j->pcelm(j))));
List(i,pcelm)));
fi;
SetSize(a,asz);
Add(new,a);
Expand Down Expand Up @@ -614,7 +614,7 @@ local g, # group
IdentityMapping(g));
IsGroupOfAutomorphismsFiniteGroup(funcs); # set filter
if IsTrivial( funcs ) then
b:=ClosureGroup(Parent(g),List(func,x->ConjugatorOfConjugatorIsomorphism(x)));
b:=ClosureGroup(Parent(g),List(func,ConjugatorOfConjugatorIsomorphism));
func:=hom2;
else
if IsSolvableGroup(funcs) then
Expand Down Expand Up @@ -661,7 +661,7 @@ local g, # group

# # check, if the series is compatible with the AgSeries and if g is a
# # parent group. If not, enforce this
# if not(IsParent(g) and ForAll(e,i->IsElementAgSeries(i))) then
# if not(IsParent(g) and ForAll(e,IsElementAgSeries)) then
# Info(InfoPcSubgroup,1," computing better series");
# isom:=IsomorphismAgGroup(e);
# g:=Image(isom,g);
Expand Down
2 changes: 1 addition & 1 deletion lib/grppcrep.gi
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ InstallGlobalFunction( FpOfModules, function( pcgs, modus )
n := Length( modus );
words := ShallowCopy( AsList( pcgs ) );
traces := List( modus, x -> Concatenation( [x.dimension],
List(x.generators, y -> TraceMat( y ))));
List(x.generators, TraceMat)));
trset := Set( traces );

# iterate computation of elements
Expand Down
2 changes: 1 addition & 1 deletion lib/grpperm.gi
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ InstallMethod( OrbitsMovedPoints, "for a permutation group", [IsPermGroup],
function(G)
local o,i;
o:=Orbits(G,MovedPoints(G));
o:=List(o,x->Set(x));
o:=List(o,Set);
List(o,IsRange); # save memory if long orbits
Sort(o);
MakeImmutable(o);
Expand Down
2 changes: 1 addition & 1 deletion lib/maxsub.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ end);
BindGlobal("NextLevelMaximals",function(g,l)
local m;
if Length(l)=0 then return [];fi;
m:=Concatenation(List(l,x->MaximalSubgroupClassReps(x)));
m:=Concatenation(List(l,MaximalSubgroupClassReps));
if Length(l)>1 then
m:=Unique(m);
fi;
Expand Down
2 changes: 1 addition & 1 deletion lib/mgmadj.gi
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function(m)
fi;

zero := Objectify(type, rec(elt:=fail));;
gens:=Concatenation(List(GeneratorsOfMagma(m), g-> inj(g)), [zero]);
gens:=Concatenation(List(GeneratorsOfMagma(m), inj), [zero]);
out:=Objectify( NewType( FamilyObj( gens ), filts), rec());

# store the magma in the family so that it can be recovered from an element
Expand Down
4 changes: 2 additions & 2 deletions lib/mgmcong.gi
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ BindGlobal("MagmaCongruencePartition",
## equivalence
##
C := List(Filtered(GeneratingPairsOfMagmaCongruence(cong),
x->not x[1]=x[2]), y->ShallowCopy(y));
x->not x[1]=x[2]), ShallowCopy);

if IsEmpty(C) then
SetEquivalenceRelationPartition(cong,[]);
Expand All @@ -487,7 +487,7 @@ BindGlobal("MagmaCongruencePartition",
else
equivrel := EquivalenceRelationPartition(
EquivalenceRelationByPairsNC(Source(cong),C));
forest := List(equivrel, x->ShallowCopy(x));
forest := List(equivrel, ShallowCopy);
fi;

## Check partial closure might be fulfilled by initial closure
Expand Down
8 changes: 4 additions & 4 deletions lib/morpheus.gi
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ local gens, inn,out, nonperm, syno, orb, orbi, perms, free, rep, i, maxl, gen,
nonperm:=Filtered(out,i->not IsConjugatorAutomorphism(i));
syno:=g;
#syno:=Group(List(Filtered(GeneratorsOfGroup(au),IsInnerAutomorphism),
# x->ConjugatorOfConjugatorIsomorphism(x)),One(g));
# ConjugatorOfConjugatorIsomorphism),One(g));
for i in Filtered(out,IsConjugatorAutomorphism) do
syno:=ClosureGroup(syno,ConjugatorOfConjugatorIsomorphism(i));
od;
Expand Down Expand Up @@ -2061,8 +2061,8 @@ local o,p,gens,hens;
hens:=IndependentGeneratorsOfAbelianGroup(H);
hens:=ShallowCopy(hens);

o:=List(gens,i->Order(i));
p:=List(hens,i->Order(i));
o:=List(gens,Order);
p:=List(hens,Order);

SortParallel(o,gens);
SortParallel(p,hens);
Expand Down Expand Up @@ -3086,7 +3086,7 @@ local Fgens, # generators of F

val:=Product(pimgs,i->Sum(i,Size));
if val<bestval then
Info(InfoMorph,2,"better value: ",List(u,i->Order(i)),
Info(InfoMorph,2,"better value: ",List(u,Order),
"->",val);
best:=[u,pimgs];
bestval:=val;
Expand Down
2 changes: 1 addition & 1 deletion lib/pcgsperm.gi
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ InstallGlobalFunction(TryPcgsPermGroup,function(arg)
elif Length(arg)>4 then
G:=arg[2];
U := TrivialSubgroup( G );
if ForAll(GeneratorsOfGroup(G),x->IsOne(x)) then G:=[G];
if ForAll(GeneratorsOfGroup(G),IsOne) then G:=[G];
else G:=[G,U];fi;
else
G:=A;
Expand Down
3 changes: 1 addition & 2 deletions lib/polyrat.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1644,8 +1644,7 @@ local i, # loops
fi;

# compute the possible degrees
tmp:=Set(Combinations(List(lp,DegreeOfLaurentPolynomial)),
g -> Sum(g));
tmp:=Set(Combinations(List(lp,DegreeOfLaurentPolynomial)),Sum);
if 1 = i then
deg:=tmp;
else
Expand Down
16 changes: 8 additions & 8 deletions lib/relation.gi
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ InstallGlobalFunction(BinaryRelationOnPointsNC,

SetSource(rel, Domain([1..d]));
SetRange(rel, Domain([1..d]));
SetSuccessors(rel, List(lst,x->AsSSortedList(x)));
SetSuccessors(rel, List(lst,AsSSortedList));
SetDegreeOfBinaryRelation(rel,d);

return rel;
Expand Down Expand Up @@ -923,7 +923,7 @@ InstallMethod(SymmetricClosureBinaryRelation, "for binary relations on points",
i,j, #Index variables
newrel; #new relation which is the symmetric closure

suc := List(Successors(rel),x->ShallowCopy(x));
suc := List(Successors(rel),ShallowCopy);
for i in [1..DegreeOfBinaryRelation(rel)] do
for j in Successors(rel)[i] do
UniteSet(suc[j],[i]);
Expand All @@ -944,7 +944,7 @@ InstallMethod(TransitiveClosureBinaryRelation, "for binary relations on points",
local i,j, #index variables
suc; #successors of given relation

suc := List(Successors(rel),x->ShallowCopy(x));
suc := List(Successors(rel),ShallowCopy);

# if \i in suc[j] then everything related to \i
# should be in suc[j].
Expand Down Expand Up @@ -1439,9 +1439,9 @@ InstallGlobalFunction(EquivalenceRelationByPairsNC,
##
if (IsSet(pairs)) or
(HasIsDuplicateFreeList(pairs) and IsDuplicateFreeList(pairs)) then
C := List(pairs,x->ShallowCopy(x));
C := List(pairs,ShallowCopy);
else
C := DuplicateFreeList(List(pairs,x->ShallowCopy(x)));
C := DuplicateFreeList(List(pairs,ShallowCopy));
fi;

##
Expand Down Expand Up @@ -1550,7 +1550,7 @@ InstallGlobalFunction(EquivalenceRelationByPairs,
## Make a mutable copy of pairs so we don't inadvertently alter
## pairs
##
C := List(Filtered(pairs,x->not x[1]=x[2]), y->ShallowCopy(y));
C := List(Filtered(pairs,x->not x[1]=x[2]), ShallowCopy);

##
## Return diagonal relation if all pairs are of the form (a,a)
Expand Down Expand Up @@ -1708,8 +1708,8 @@ InstallMethod(\=, "for eqivalence relations", IsIdenticalObj,

## Similar lengths of the partition elements
##
if Set(EquivalenceRelationPartition(x), i->Length(i)) <>
Set(EquivalenceRelationPartition(y), i->Length(i)) then
if Set(EquivalenceRelationPartition(x), Length) <>
Set(EquivalenceRelationPartition(y), Length) then
return false;
fi;

Expand Down
2 changes: 1 addition & 1 deletion lib/semirel.gi
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ InstallMethod(EggBoxOfDClass, "for a Green's D class", true,
[IsGreensDClass],0,
function(d)

return List(GreensRClasses(d), x-> GreensHClasses(x));
return List(GreensRClasses(d), GreensHClasses);
end);

#############################################################################
Expand Down
2 changes: 1 addition & 1 deletion lib/semitran.gi
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function( s )
local egens, gens, mapfun;

egens := GeneratorsOfSemigroup(s);
if not ForAll(egens, g->IsMapping(g)) then
if not ForAll(egens, IsMapping) then
return fail;
fi;

Expand Down
2 changes: 1 addition & 1 deletion lib/wordrep.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1575,7 +1575,7 @@ function( f, w )
local l,gens,g,i,p;

Info(InfoWarning,2,"obsolete undocumented method");
gens:=List(FreeGeneratorsOfFpGroup(f),x->ExtRepOfObj(x));
gens:=List(FreeGeneratorsOfFpGroup(f),ExtRepOfObj);
g:=gens{[1..Length(gens)]}[1];
l:=List(gens,x->0);
w:= ExtRepOfObj( w );
Expand Down
Loading

0 comments on commit 7d5e974

Please sign in to comment.