From 0b833bd2f3cf0e87d4240b3d6a3953d8050b90f5 Mon Sep 17 00:00:00 2001 From: Nicolas Luck Date: Fri, 21 Jul 2023 00:23:35 +0200 Subject: [PATCH] Add missing write_goal/3 to lib_toplevel.pl --- src/lib_toplevel.pl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/lib_toplevel.pl b/src/lib_toplevel.pl index 3bdb2bb6..70ece273 100644 --- a/src/lib_toplevel.pl +++ b/src/lib_toplevel.pl @@ -50,6 +50,26 @@ needs_bracketing(Value, Op) :- memberchk(EqSpec, [fx,xfx,yfx]) ). +write_goal(G, VarList, MaxDepth) :- + ( G = (Var = Value) -> + ( var(Value) -> + select((Var = _), VarList, NewVarList) + ; VarList = NewVarList + ), + write(Var), + write(' = '), + ( needs_bracketing(Value, (=)) -> + write('('), + write_term(Value, [quoted(true), variable_names(NewVarList), max_depth(MaxDepth)]), + write(')') + ; write_term(Value, [quoted(true), variable_names(NewVarList), max_depth(MaxDepth)]) + ) + ; G == [] -> + write('true') + ; write_term(G, [quoted(true), variable_names(VarList), max_depth(MaxDepth)]) + ). + + write_last_goal(G, VarList, MaxDepth) :- ( G = (Var = Value) -> ( var(Value) -> -- 2.54.0