From efeaa7b8e1a4bc801081af31d3936af47db46ed5 Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Tue, 16 Jul 2019 09:46:55 -0700 Subject: [PATCH] A little helper function to see compiled expressions. Example from ordered binary tree notebook: ?- sjc(tree_add_Ee, `pop swap rolldown rrest ccons`). func(tree_add_Ee, [_, [_, _|C], A, B|D], [[A, B|C]|D]). true . --- thun/thun.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/thun/thun.pl b/thun/thun.pl index 9d7bb81..a2ab4cb 100644 --- a/thun/thun.pl +++ b/thun/thun.pl @@ -211,6 +211,8 @@ jcmpl(Name, Expression, Rule) :- rule(Head, [], Head ). rule(Head, [A|B], Head :- maplist(call, [A|B])). +sjc(Name, InputString) :- phrase(joy_parse(E), InputString), show_joy_compile(Name, E). + % Simple DCGs to expand/contract definitions.