From 7f46bd8b06e414fdaa0494ac5a899d7bbeffb03e Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 10 Feb 2023 14:29:46 +0100 Subject: [PATCH] Avoid unnecessary uses of EvalString ... and correctly check for the presence of a certain global variable. --- gap/helpers.gi | 8 ++++---- gap/mealy.gi | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/gap/helpers.gi b/gap/helpers.gi index 842f339..38ca851 100644 --- a/gap/helpers.gi +++ b/gap/helpers.gi @@ -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; @@ -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)); @@ -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); diff --git a/gap/mealy.gi b/gap/mealy.gi index 8db8f83..0b1244b 100644 --- a/gap/mealy.gi +++ b/gap/mealy.gi @@ -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;