Skip to content

Commit 36ec6dc

Browse files
committed
Take advantage of GAP 4.11 features
1 parent 1d910df commit 36ec6dc

File tree

3 files changed

+17
-24
lines changed

3 files changed

+17
-24
lines changed

gap/attr.gi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1814,8 +1814,8 @@ function(D, maxLength)
18141814
# Extends a given chordless path if possible
18151815
CCExtension := function(D, path, C, key, blocked)
18161816
local v, extendedPath, data;
1817-
blocked := BlockNeighbours(D, path[Length(path)], blocked);
1818-
for v in OutNeighboursOfVertex(D, path[Length(path)]) do
1817+
blocked := BlockNeighbours(D, Last(path), blocked);
1818+
for v in OutNeighboursOfVertex(D, Last(path)) do
18191819
if DigraphVertexLabel(D, v) > key and blocked[v] = 1
18201820
and Length(path) < maxLength then
18211821
extendedPath := Concatenation(path, [v]);
@@ -1828,7 +1828,7 @@ function(D, maxLength)
18281828
fi;
18291829
fi;
18301830
od;
1831-
blocked := UnblockNeighbours(D, path[Length(path)], blocked);
1831+
blocked := UnblockNeighbours(D, Last(path), blocked);
18321832
return [C, blocked];
18331833
end;
18341834

gap/io.gi

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -275,10 +275,10 @@ function(filename)
275275
fi;
276276

277277
splitname := SplitString(filename, ".");
278-
extension := splitname[Length(splitname)];
278+
extension := Remove(splitname);
279279

280280
if extension in ["gz", "bz2", "xz"] then
281-
extension := splitname[Length(splitname) - 1];
281+
extension := Remove(splitname);
282282
fi;
283283

284284
if extension = "txt" then
@@ -313,10 +313,10 @@ function(filename)
313313
fi;
314314

315315
splitname := SplitString(filename, ".");
316-
extension := splitname[Length(splitname)];
316+
extension := Remove(splitname);
317317

318318
if extension in ["gz", "bz2", "xz"] then
319-
extension := splitname[Length(splitname) - 1];
319+
extension := Remove(splitname);
320320
fi;
321321

322322
if extension = "txt" then
@@ -549,9 +549,8 @@ function(arg...)
549549
# the file encoder was not specified and cannot be deduced from the
550550
# filename, so we try to make a guess based on the digraphs themselves
551551
splitname := SplitString(name, ".");
552-
if splitname[Length(splitname)] in ["xz", "gz", "bz2"] then
553-
compext := splitname[Length(splitname)];
554-
splitname := splitname{[1 .. Length(splitname) - 1]};
552+
if Last(splitname) in ["xz", "gz", "bz2"] then
553+
compext := Remove(splitname);
555554
fi;
556555

557556
# Do we know all the graphs to be symmetric?
@@ -647,7 +646,7 @@ function(arg...)
647646
" is a whole file encoder, and so only one digraph should be ",
648647
"specified. Only the last digraph will be encoded.");
649648
fi;
650-
IO_Write(file, encoder(digraphs[Length(digraphs)]));
649+
IO_Write(file, encoder(Last(digraphs)));
651650
else
652651
for i in [1 .. Length(digraphs)] do
653652
encoder(file, digraphs[i]);
@@ -715,7 +714,7 @@ function(filt, s)
715714
maxedges := n * (n - 1) / 2;
716715
if list <> [0] and list <> [1] and
717716
not (Int((maxedges - 1) / 6) + start = Length(list) and
718-
list[Length(list)] mod 2 ^ ((0 - maxedges) mod 6) = 0) then
717+
Last(list) mod 2 ^ ((0 - maxedges) mod 6) = 0) then
719718
ErrorNoReturn("the 2nd argument <s> is not a valid graph6 string,");
720719
fi;
721720

@@ -732,8 +731,8 @@ function(filt, s)
732731
i := i / 2;
733732
else
734733
edge := FindCoord(pos + 6 - bpos, 0);
735-
out[edge[1]][Length(out[edge[1]]) + 1] := edge[2];
736-
out[edge[2]][Length(out[edge[2]]) + 1] := edge[1];
734+
Add(out[edge[1]], edge[2]);
735+
Add(out[edge[2]], edge[1]);
737736
nredges := nredges + 1;
738737
i := (i - 1) / 2;
739738
fi;
@@ -2165,7 +2164,7 @@ function(args...)
21652164
positions := PositionsProperty(partition, x -> x = i);
21662165
joinedPositions := JoinStringsWithSeparator(positions, " ");
21672166
partitionString := Concatenation(partitionString, joinedPositions);
2168-
if i <> dflabels[Length(dflabels)] then
2167+
if i <> Last(dflabels) then
21692168
partitionString := Concatenation(partitionString, " | ");
21702169
fi;
21712170
od;

makedoc.g

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,9 @@ for Pkg in Concatenation(PkgInfo.Dependencies.NeededOtherPackages,
5252
XMLEntities.(entity_name) := RemovePrefixVersion(Pkg[2]);
5353
od;
5454

55-
# Can change the following line to use Last() once we drop GAP 4.10 support
56-
ARCHIVE_BASENAME := SplitString(PkgInfo.ArchiveURL, "/");
57-
ARCHIVE_BASENAME := ARCHIVE_BASENAME[Length(ARCHIVE_BASENAME)];
58-
XMLEntities.ARCHIVE_BASENAME := ARCHIVE_BASENAME;
59-
60-
ARCHIVENAME := Concatenation(ARCHIVE_BASENAME, PkgInfo.ArchiveFormats);
61-
XMLEntities.ARCHIVENAME := ARCHIVENAME;
62-
55+
XMLEntities.ARCHIVE_BASENAME := Last(SplitString(PkgInfo.ArchiveURL, "/"));
56+
XMLEntities.ARCHIVENAME := Concatenation(XMLEntities.ARCHIVE_BASENAME,
57+
PkgInfo.ArchiveFormats);
6358
XMLEntities.DIGRAPHS := PackageEntity("Digraphs");
6459

6560
for Pkg in Concatenation(PkgInfo.Dependencies.NeededOtherPackages,
@@ -155,7 +150,6 @@ Unbind(MathOrCode);
155150
Unbind(XMLEntities);
156151
Unbind(PkgInfo);
157152
Unbind(Pkg);
158-
Unbind(ARCHIVENAME);
159153
Unbind(DocDir);
160154
Unbind(Files);
161155
Unbind(Includes);

0 commit comments

Comments
 (0)