Skip to content

Commit

Permalink
Merge pull request #61 from fingolfin/mh/no-EvalString
Browse files Browse the repository at this point in the history
Avoid unnecessary uses of EvalString
  • Loading branch information
laurentbartholdi authored Jan 11, 2024
2 parents c5ed6d3 + 7f46bd8 commit e90b89c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions gap/helpers.gi
Original file line number Diff line number Diff line change
Expand Up @@ -484,8 +484,8 @@ InstallGlobalFunction(WordGrowth, function(arg)
if IsString(draw) then
AppendTo(draw,S);
else
if IsBound(JupyterRenderable) then
return EvalString("JupyterRenderable")(rec(("image/svg+xml") :=IO_PipeThrough("dot",["-Tsvg"],S)),rec());
if IsBoundGlobal("JupyterRenderable") then
return ValueGlobal("JupyterRenderable")(rec(("image/svg+xml") :=IO_PipeThrough("dot",["-Tsvg"],S)),rec());
else
DOT2DISPLAY@(S, "neato");
fi;
Expand All @@ -498,7 +498,7 @@ end);
InstallOtherMethod(Draw, "(FR) default",
[IsObject],
function(l)
if IsBound(JupyterRenderable) then
if IsBoundGlobal("JupyterRenderable") then
return WordGrowth(l,rec(draw:=true));
else
WordGrowth(l,rec(draw:=true));
Expand All @@ -516,7 +516,7 @@ InstallOtherMethod(Draw, "(FR) default, with options",
function(l,options)
options := ShallowCopy(options);
options.draw := true;
if IsBound(JupyterRenderable) then # a hack
if IsBoundGlobal("JupyterRenderable") then # a hack
return WordGrowth(l,options);
else
WordGrowth(l,options);
Expand Down
4 changes: 2 additions & 2 deletions gap/mealy.gi
Original file line number Diff line number Diff line change
Expand Up @@ -1195,8 +1195,8 @@ end);

BindGlobal("DRAWMEALY@", function(M)
# more a hack than a clean implementation...
if IsBound(JupyterRenderable) then
return EvalString("JupyterRenderable")(rec(("image/svg+xml") :=IO_PipeThrough("dot",["-Tsvg"],MM2DOT@(M))),rec());
if IsBoundGlobal("JupyterRenderable") then
return ValueGlobal("JupyterRenderable")(rec(("image/svg+xml") :=IO_PipeThrough("dot",["-Tsvg"],MM2DOT@(M))),rec());
else
DOT2DISPLAY@(MM2DOT@(M),"dot");
fi;
Expand Down

0 comments on commit e90b89c

Please sign in to comment.