[Joypy-announce] joypy/Joypy: 3 new changesets

アーカイブの一覧に戻る
scmno****@osdn***** scmno****@osdn*****
Sat Aug 10 08:58:57 JST 2019


changeset 9e2a9e54c425 in joypy/Joypy
details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=9e2a9e54c425
user: Simon Forman <sform****@hushm*****>
date: Fri Aug 09 16:37:33 2019 -0700
description: Demo grow/shrink.
changeset aa7225f0aa58 in joypy/Joypy
details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=aa7225f0aa58
user: Simon Forman <sform****@hushm*****>
date: Fri Aug 09 16:53:40 2019 -0700
description: Prevent definitions from shadowing functions.
changeset bb69faf33d10 in joypy/Joypy
details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=bb69faf33d10
user: Simon Forman <sform****@hushm*****>
date: Fri Aug 09 16:58:34 2019 -0700
description: Also don't shadow combinators.

(I realized that the way defs are parsed now means that each def
(but the last) is first asserted with the wrong definition expression
(it includes the symbol of the following definition at the end) and
then the parser figures out that there's another defintion following
and re-asserts the correct expression.  It would be nice to fix that
but it's kind of a PITA.  I used to build a list of definitions and
then assert them all at the end.  For now there aren't enough defs to
justify the extra work.

diffstat:

 thun/thun.pl |  21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diffs (45 lines):

diff -r 79d98f005ded -r bb69faf33d10 thun/thun.pl
--- a/thun/thun.pl	Fri Aug 09 09:28:15 2019 -0700
+++ b/thun/thun.pl	Fri Aug 09 16:58:34 2019 -0700
@@ -202,7 +202,9 @@
 
 joy_def(def(Def, Body)) --> symbol(Def), blanks, "==", joy_parse(Body).
 
-joy_defs --> blanks, joy_def(Def), {assert_def(Def)}, blanks, joy_defs.
+joy_def --> joy_def(Def), {ignore(assert_def(Def))}.
+
+joy_defs --> blanks, joy_def, blanks, joy_defs.
 joy_defs --> [].
 
 assert_defs(DefsFile) :-
@@ -210,6 +212,8 @@
     phrase(joy_defs, Codes).
 
 assert_def(def(Def, Body)) :-
+    \+ func(Def, _, _),
+    \+ combo(Def, _, _, _, _),
     retractall(def(Def, _)),
     assertz(def(Def, Body)).
 
@@ -337,6 +341,21 @@
 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)}.



More information about the Joypy-announce mailing list
アーカイブの一覧に戻る