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

Back to archive index
scmno****@osdn***** scmno****@osdn*****
Mon Aug 12 13:35:58 JST 2019


changeset 469c7fc24c6e in joypy/Joypy
details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=469c7fc24c6e
user: Simon Forman <sform****@hushm*****>
date: Sun Aug 11 20:45:49 2019 -0700
description: Remove a cut that sucked.
changeset 482351329728 in joypy/Joypy
details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=482351329728
user: Simon Forman <sform****@hushm*****>
date: Sun Aug 11 21:30:02 2019 -0700
description: Experiment with putting logic vars on the stack.

diffstat:

 thun/gnu-prolog/defs.pl   |  2 ++
 thun/gnu-prolog/defs.txt  |  1 +
 thun/gnu-prolog/main.pl   |  4 +---
 thun/gnu-prolog/parser.pl |  6 ++++--
 thun/gnu-prolog/thun.pl   |  1 +
 5 files changed, 9 insertions(+), 5 deletions(-)

diffs (66 lines):

diff -r fa6d3b3810b8 -r 482351329728 thun/gnu-prolog/defs.pl
--- a/thun/gnu-prolog/defs.pl	Sun Aug 11 19:57:28 2019 -0700
+++ b/thun/gnu-prolog/defs.pl	Sun Aug 11 21:30:02 2019 -0700
@@ -28,8 +28,10 @@
 def(hypot,[[sqr],ii,+,sqrt]).
 def(ifte,[[nullary],dipd,swap,branch]).
 def(ii,[[dip],dupdip,i]).
+def(infer,[thunk,dup,rollup,infra]).
 def(infra,[swons,swaack,[i],dip,swaack]).
 def(infrst,[infra,first]).
+def(least_fraction,[dup,[gcd],infra,[div],concat,map]).
 def(make_generator,[[codireco],ccons]).
 def(neg,[0,swap,-]).
 def(nullary,[[stack],dinfrirst]).
diff -r fa6d3b3810b8 -r 482351329728 thun/gnu-prolog/defs.txt
--- a/thun/gnu-prolog/defs.txt	Sun Aug 11 19:57:28 2019 -0700
+++ b/thun/gnu-prolog/defs.txt	Sun Aug 11 21:30:02 2019 -0700
@@ -30,6 +30,7 @@
 hypot == [sqr] ii + sqrt
 ifte == [nullary] dipd swap branch
 ii == [dip] dupdip i
+infer == thunk dup rollup infra
 infra == swons swaack [i] dip swaack
 infrst == infra first
 least_fraction == dup [gcd] infra [div] concat map
diff -r fa6d3b3810b8 -r 482351329728 thun/gnu-prolog/main.pl
--- a/thun/gnu-prolog/main.pl	Sun Aug 11 19:57:28 2019 -0700
+++ b/thun/gnu-prolog/main.pl	Sun Aug 11 21:30:02 2019 -0700
@@ -35,9 +35,7 @@
   line(NextLine), !,
   loop(NextLine, S, Out).
 
-do_line(Line, In, Out) :-
-    phrase(joy_parse(E), Line), !,
-    thun(E, In, Out).
+do_line(Line, In, Out) :- phrase(joy_parse(E), Line), thun(E, In, Out).
 do_line(_Line, S,   S) :- write('Err'), nl.
 
 prompt :- write(`joy? `).
diff -r fa6d3b3810b8 -r 482351329728 thun/gnu-prolog/parser.pl
--- a/thun/gnu-prolog/parser.pl	Sun Aug 11 19:57:28 2019 -0700
+++ b/thun/gnu-prolog/parser.pl	Sun Aug 11 21:30:02 2019 -0700
@@ -100,8 +100,10 @@
 format_joy([T|S]) --> format_term(T), " ", format_joy(S).
 format_joy([])    --> [].
 
-format_term(N) --> {number(N), number_codes(N, Codes)}, Codes.
-format_term(A) --> {  atom(A),   atom_codes(A, Codes)}, Codes.
+format_term(N) --> {number(N),   number_codes(N, Codes)}, Codes.
+format_term(A) --> {  atom(A),     atom_codes(A, Codes)}, Codes.
+format_term(V) --> {   var(V), write_to_codes(Codes, V)}, Codes.
 format_term([A|As]) --> "[", format_joy([A|As]), "]".
+format_term(F) --> {    write_to_codes(Codes, F)}, Codes.
 
 
diff -r fa6d3b3810b8 -r 482351329728 thun/gnu-prolog/thun.pl
--- a/thun/gnu-prolog/thun.pl	Sun Aug 11 19:57:28 2019 -0700
+++ b/thun/gnu-prolog/thun.pl	Sun Aug 11 21:30:02 2019 -0700
@@ -91,6 +91,7 @@
 func(first, [[X|_]|S],   [X|S]).
 func(rest,  [[_|X]|S],   [X|S]).
 func(unit,      [X|S], [[X]|S]).
+func(thunk,        S ,   [X|S]).
 
 func(rolldown, [A, B, C|S], [B, C, A|S]).
 func(dupd,        [A, B|S], [A, B, B|S]).



More information about the Joypy-announce mailing list
Back to archive index