From 49491bceefec144f9e31fa321b1f3d844762eaeb Mon Sep 17 00:00:00 2001 From: Simon Forman Date: Fri, 9 Aug 2019 16:37:33 -0700 Subject: [PATCH] Demo grow/shrink. --- thun/thun.pl | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/thun/thun.pl b/thun/thun.pl index 7097c00..b8cbe81 100644 --- a/thun/thun.pl +++ b/thun/thun.pl @@ -337,6 +337,21 @@ to_fixed_point(DCG, Ei, Eo) :- grow --> to_fixed_point(rebo(expando, grow )). shrink --> to_fixed_point(rebo(contracto, shrink)). +% ?- phrase(grow, [third], Out). +% Out = [rest, rest, first] ; +% Out = [rest, rest, first] ; +% Out = [rest, second] ; +% Out = [third]. + +% ?- phrase(grow, In, [rest, rest, first]). +% Action (h for help) ? abort +% % Execution Aborted +% ?- phrase(shrink, [rest, rest, first], Out). +% Out = [rrest, first] ; +% Out = [third] ; +% Out = [rest, second] ; +% Out = [rest, rest, first]. + % format_n(N) --> {number(N), !, number_codes(N, Codes)}, Codes. % format_n(N) --> signed_digits(Codes), !, {number_codes(N, Codes)}.