Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve Issue #463: EvalString -> ValueGlobal #464

Merged
merged 1 commit into from
Mar 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions gap/semigroups/semicons.gi
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ for _IsXSemigroup in ["IsFpSemigroup",
"IsReesZeroMatrixSemigroup"] do
InstallMethod(TrivialSemigroupCons,
Concatenation("for ", _IsXSemigroup, " and an integer"),
[EvalString(_IsXSemigroup), IsInt],
[ValueGlobal(_IsXSemigroup), IsInt],
function(filter, deg)
local n;
n := Maximum(deg, 1);
Expand Down Expand Up @@ -249,7 +249,7 @@ for IsXSemigroup in ["IsPBRSemigroup",
"IsReesZeroMatrixSemigroup"] do
InstallMethod(MonogenicSemigroupCons,
Concatenation("for ", IsXSemigroup, " and two positive integers"),
[EvalString(IsXSemigroup), IsPosInt, IsPosInt],
[ValueGlobal(IsXSemigroup), IsPosInt, IsPosInt],
function(filter, m, r)
return AsSemigroup(filter,
MonogenicSemigroupCons(IsTransformationSemigroup, m, r));
Expand Down Expand Up @@ -409,7 +409,7 @@ for IsXSemigroup in ["IsBooleanMatSemigroup",
"IsIntegerMatrixSemigroup"] do
InstallMethod(RectangularBandCons,
Concatenation("for ", IsXSemigroup, ", pos int, and pos int"),
[EvalString(IsXSemigroup), IsPosInt, IsPosInt],
[ValueGlobal(IsXSemigroup), IsPosInt, IsPosInt],
function(filter, m, n)
return AsSemigroup(filter,
RectangularBandCons(IsTransformationSemigroup, m, n));
Expand Down Expand Up @@ -582,7 +582,7 @@ for _IsXSemigroup in ["IsPBRSemigroup",
"IsIntegerMatrixSemigroup"] do
InstallMethod(ZeroSemigroupCons,
Concatenation("for ", _IsXSemigroup, " and a positive integer"),
[EvalString(_IsXSemigroup), IsPosInt],
[ValueGlobal(_IsXSemigroup), IsPosInt],
function(filter, n)
return AsSemigroup(filter,
ZeroSemigroupCons(IsTransformationSemigroup, n));
Expand Down
66 changes: 33 additions & 33 deletions gap/semigroups/semimaxplus.gi
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ for _IsXMatrix in ["IsMaxPlusMatrix",

InstallMethod(RandomInverseSemigroupCons,
Concatenation("for ", _IsXSemigroup, " and a list"),
[EvalString(_IsXSemigroup), IsList],
[ValueGlobal(_IsXSemigroup), IsList],
SEMIGROUPS.DefaultRandomInverseSemigroup);

InstallMethod(RandomInverseMonoidCons,
Concatenation("for ", _IsXMonoid, " and a list"),
[EvalString(_IsXMonoid), IsList],
[ValueGlobal(_IsXMonoid), IsList],
SEMIGROUPS.DefaultRandomInverseMonoid);

od;
Expand All @@ -53,32 +53,32 @@ _InstallRandom0 := function(IsXMatrix)
IsXMonoid := Concatenation(IsXMatrix, "Monoid");

InstallMethod(SEMIGROUPS_ProcessRandomArgsCons,
[EvalString(IsXSemigroup), IsList],
[ValueGlobal(IsXSemigroup), IsList],
function(filt, params)
return SEMIGROUPS_ProcessRandomArgsCons(IsSemigroup, params);
end);

InstallMethod(SEMIGROUPS_ProcessRandomArgsCons,
[EvalString(IsXMonoid), IsList],
[ValueGlobal(IsXMonoid), IsList],
function(filt, params)
return SEMIGROUPS_ProcessRandomArgsCons(IsSemigroup, params);
end);

InstallMethod(RandomSemigroupCons,
Concatenation("for ", IsXSemigroup, " and a list"),
[EvalString(IsXSemigroup), IsList],
[ValueGlobal(IsXSemigroup), IsList],
function(filt, params)
return Semigroup(List([1 .. params[1]],
i -> RandomMatrix(EvalString(IsXMatrix),
i -> RandomMatrix(ValueGlobal(IsXMatrix),
params[2])));
end);

InstallMethod(RandomMonoidCons,
Concatenation("for ", IsXMonoid, " and a list"),
[EvalString(IsXMonoid), IsList],
[ValueGlobal(IsXMonoid), IsList],
function(filt, params)
return Monoid(List([1 .. params[1]],
i -> RandomMatrix(EvalString(IsXMatrix), params[2])));
i -> RandomMatrix(ValueGlobal(IsXMatrix), params[2])));
end);
end;

Expand Down Expand Up @@ -125,27 +125,27 @@ _InstallRandom1 := function(IsXMatrix)
IsXMonoid := Concatenation(IsXMatrix, "Monoid");

InstallMethod(SEMIGROUPS_ProcessRandomArgsCons,
[EvalString(IsXSemigroup), IsList], _ProcessArgs1);
[ValueGlobal(IsXSemigroup), IsList], _ProcessArgs1);

InstallMethod(SEMIGROUPS_ProcessRandomArgsCons,
[EvalString(IsXMonoid), IsList], _ProcessArgs1);
[ValueGlobal(IsXMonoid), IsList], _ProcessArgs1);

InstallMethod(RandomSemigroupCons,
Concatenation("for ", IsXSemigroup, " and a list"),
[EvalString(IsXSemigroup), IsList],
[ValueGlobal(IsXSemigroup), IsList],
function(filt, params)
return Semigroup(List([1 .. params[1]],
i -> RandomMatrix(EvalString(IsXMatrix),
i -> RandomMatrix(ValueGlobal(IsXMatrix),
params[2],
params[3])));
end);

InstallMethod(RandomMonoidCons,
Concatenation("for ", IsXMonoid, " and a list"),
[EvalString(IsXMonoid), IsList],
[ValueGlobal(IsXMonoid), IsList],
function(filt, params)
return Monoid(List([1 .. params[1]],
i -> RandomMatrix(EvalString(IsXMatrix),
i -> RandomMatrix(ValueGlobal(IsXMatrix),
params[2],
params[3])));
end);
Expand Down Expand Up @@ -242,12 +242,12 @@ for _IsXMatrix in ["IsMaxPlusMatrix",

InstallMethod(IsomorphismSemigroup,
Concatenation("for ", _IsXSemigroup, " and a semigroup"),
[EvalString(_IsXSemigroup), IsSemigroup],
[ValueGlobal(_IsXSemigroup), IsSemigroup],
SEMIGROUPS.DefaultIsomorphismSemigroup);

InstallMethod(IsomorphismSemigroup,
Concatenation("for ", _IsXSemigroup, " and a ", _IsXSemigroup),
[EvalString(_IsXSemigroup), EvalString(_IsXSemigroup)],
[ValueGlobal(_IsXSemigroup), ValueGlobal(_IsXSemigroup)],
function(filter, S)
return MagmaIsomorphismByFunctionsNC(S, S, IdFunc, IdFunc);
end);
Expand All @@ -266,7 +266,7 @@ for _IsXMatrix in ["IsTropicalMaxPlusMatrix",

InstallMethod(IsomorphismSemigroup,
Concatenation("for ", _IsXSemigroup, ", pos int, and a semigroup"),
[EvalString(_IsXSemigroup), IsPosInt, IsSemigroup],
[ValueGlobal(_IsXSemigroup), IsPosInt, IsSemigroup],
function(filter, threshold, S)
local iso1, inv1, iso2, inv2;

Expand All @@ -283,7 +283,7 @@ for _IsXMatrix in ["IsTropicalMaxPlusMatrix",

InstallMethod(IsomorphismSemigroup,
Concatenation("for ", _IsXSemigroup, " and a ", _IsXSemigroup),
[EvalString(_IsXSemigroup), IsPosInt, EvalString(_IsXSemigroup)],
[ValueGlobal(_IsXSemigroup), IsPosInt, ValueGlobal(_IsXSemigroup)],
function(filter, threshold, S)
if threshold = ThresholdTropicalMatrix(Representative(S)) then
return MagmaIsomorphismByFunctionsNC(S, S, IdFunc, IdFunc);
Expand Down Expand Up @@ -342,36 +342,36 @@ _InstallIsomorphism0 := function(filter)

InstallMethod(AsMonoid,
Concatenation("for a semigroup in ", IsXSemigroup),
[EvalString(IsXSemigroup)],
[ValueGlobal(IsXSemigroup)],
function(S)
if MultiplicativeNeutralElement(S) = fail then
return fail; # so that we do the same as the GAP/ref manual says
fi;
return Range(IsomorphismMonoid(EvalString(IsXMonoid), S));
return Range(IsomorphismMonoid(ValueGlobal(IsXMonoid), S));
end);

InstallMethod(IsomorphismMonoid,
Concatenation("for ", IsXMonoid, " and a semigroup"),
[EvalString(IsXMonoid), IsSemigroup],
[ValueGlobal(IsXMonoid), IsSemigroup],
SEMIGROUPS.DefaultIsomorphismMonoid);

InstallMethod(IsomorphismMonoid,
Concatenation("for ", IsXMonoid, " and a monoid"),
[EvalString(IsXMonoid), IsMonoid],
[ValueGlobal(IsXMonoid), IsMonoid],
function(filter, S)
return IsomorphismSemigroup(EvalString(IsXSemigroup), S);
return IsomorphismSemigroup(ValueGlobal(IsXSemigroup), S);
end);

InstallMethod(IsomorphismSemigroup,
Concatenation("for ", IsXSemigroup,
" and a transformation semigroup with generators"),
[EvalString(IsXSemigroup),
[ValueGlobal(IsXSemigroup),
IsTransformationSemigroup and HasGeneratorsOfSemigroup],
function(filt, S)
local n, map, T;

n := Maximum(DegreeOfTransformationSemigroup(S), 1);
map := x -> AsMatrix(EvalString(IsXMatrix), x, n);
map := x -> AsMatrix(ValueGlobal(IsXMatrix), x, n);
T := Semigroup(List(GeneratorsOfSemigroup(S), map));
UseIsomorphismRelation(S, T);

Expand Down Expand Up @@ -409,17 +409,17 @@ _InstallIsomorphism1 := function(filter)

InstallMethod(AsMonoid,
Concatenation("for a semigroup in ", IsXSemigroup),
[EvalString(IsXSemigroup)],
[ValueGlobal(IsXSemigroup)],
function(S)
if MultiplicativeNeutralElement(S) = fail then
return fail; # so that we do the same as the GAP/ref manual says
fi;
return Range(IsomorphismMonoid(EvalString(IsXMonoid), S));
return Range(IsomorphismMonoid(ValueGlobal(IsXMonoid), S));
end);

InstallMethod(IsomorphismMonoid,
Concatenation("for ", IsXMonoid, ", and a semigroup in", IsXSemigroup),
[EvalString(IsXMonoid), EvalString(IsXSemigroup)],
[ValueGlobal(IsXMonoid), ValueGlobal(IsXSemigroup)],
function(filter, S)
return IsomorphismMonoid(filter,
ThresholdTropicalMatrix(Representative(S)),
Expand All @@ -428,7 +428,7 @@ _InstallIsomorphism1 := function(filter)

InstallMethod(IsomorphismMonoid,
Concatenation("for ", IsXMonoid, ", pos int, and a semigroup"),
[EvalString(IsXMonoid), IsPosInt, IsSemigroup],
[ValueGlobal(IsXMonoid), IsPosInt, IsSemigroup],
function(filter, threshold, S)
local iso1, inv1, iso2, inv2;

Expand All @@ -445,21 +445,21 @@ _InstallIsomorphism1 := function(filter)

InstallMethod(IsomorphismMonoid,
Concatenation("for ", IsXMonoid, ", pos int, and a monoid"),
[EvalString(IsXMonoid), IsPosInt, IsMonoid],
[ValueGlobal(IsXMonoid), IsPosInt, IsMonoid],
function(filter, threshold, S)
return IsomorphismSemigroup(EvalString(IsXSemigroup), threshold, S);
return IsomorphismSemigroup(ValueGlobal(IsXSemigroup), threshold, S);
end);

InstallMethod(IsomorphismSemigroup,
Concatenation("for ", IsXSemigroup,
", pos int, and a transformation semigroup with generators"),
[EvalString(IsXSemigroup), IsPosInt,
[ValueGlobal(IsXSemigroup), IsPosInt,
IsTransformationSemigroup and HasGeneratorsOfSemigroup],
function(filt, threshold, S)
local n, map, T;

n := Maximum(DegreeOfTransformationSemigroup(S), 1);
map := x -> AsMatrix(EvalString(IsXMatrix), x, n, threshold);
map := x -> AsMatrix(ValueGlobal(IsXMatrix), x, n, threshold);
T := Semigroup(List(GeneratorsOfSemigroup(S), map));
UseIsomorphismRelation(S, T);

Expand Down
4 changes: 2 additions & 2 deletions gap/tools/utils.gi
Original file line number Diff line number Diff line change
Expand Up @@ -496,12 +496,12 @@ SEMIGROUPS.CheckManSectionTypes := function(doc, verbose...)
name := elt.attributes.Name;
if not name in ["IsBound", "Unbind", "Info", "Assert", "TryNextMethod",
"QUIT", "-infinity"] then
if EvalString(Concatenation("IsBound(", name, ")")) <> true then
if not IsBoundGlobal(name) then
pos := OriginalPositionDocument(doc[2], elt.start);
Print(pos[1], ":", pos[2], " : ", name, " is unbound \n");
errcount := errcount + 1;
else
obj := EvalString(name);
obj := ValueGlobal(name);
man := SEMIGROUPS.ManSectionType(obj);
# we allow to use "Meth" for "Oper" but probably should issue a warning
# if there is no at least one "Oper" for any "Meth"
Expand Down