changeset 5cae4415452f in joypy/Joypy details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=5cae4415452f user: Simon Forman <sform****@hushm*****> date: Wed Aug 07 11:40:49 2019 -0700 description: Integer DCGs that work in both directions. diffstat: thun/thun.pl | 12 +++++++++++- 1 files changed, 11 insertions(+), 1 deletions(-) diffs (26 lines): diff -r b7053efa752f -r 5cae4415452f thun/thun.pl --- a/thun/thun.pl Sun Aug 04 09:28:01 2019 -0700 +++ b/thun/thun.pl Wed Aug 07 11:40:49 2019 -0700 @@ -220,7 +220,6 @@ (append(T, Ei, Eo) ; append(F, Ei, Eo)) ). - combo(loop, [_, false|S], S, E, E ). combo(loop, [B, true|S], S, Ei, Eo) :- append(B, [B, loop|Ei], Eo). combo(loop, [B, Expr|S], S, Ei, Eo) :- @@ -316,3 +315,14 @@ grow(Ei, Eo) :- to_fixed_point(rebo(expando, grow ), Ei, Eo). shrink(Ei, Eo) :- to_fixed_point(rebo(contracto, shrink), Ei, Eo). + + +% format_n(N) --> {number(N), !, number_codes(N, Codes)}, Codes. +% format_n(N) --> signed_digits(Codes), !, {number_codes(N, Codes)}. + +% signed_digits([45|Codes]) --> [45], !, digits(Codes). +% signed_digits( Codes ) --> digits(Codes). + +% digits([Ch|Chars]) --> [Ch], {code_type(Ch, digit)}, digits(Chars). +% digits([]), [Ch] --> [Ch], {code_type(Ch, space) ; Ch=0'] }. +% digits([], [], _). % Match if followed by space, ], or nothing.