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

Back to archive index
scmno****@osdn***** scmno****@osdn*****
Mon Aug 19 04:18:02 JST 2019


changeset 727fdf55ae85 in joypy/Joypy
details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=727fdf55ae85
user: Simon Forman <sform****@hushm*****>
date: Sun Aug 18 11:47:48 2019 -0700
description: reintroduce definition of fork; it doesn't shadow func(fork, ...).
changeset d21c31c27003 in joypy/Joypy
details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=d21c31c27003
user: Simon Forman <sform****@hushm*****>
date: Sun Aug 18 12:17:37 2019 -0700
description: minor cleanup

diffstat:

 thun/gnu-prolog/defs.txt |   1 +
 thun/gnu-prolog/fork.pl  |  18 +++++++-----------
 2 files changed, 8 insertions(+), 11 deletions(-)

diffs (49 lines):

diff -r e0100f4a11e4 -r d21c31c27003 thun/gnu-prolog/defs.txt
--- a/thun/gnu-prolog/defs.txt	Sun Aug 18 11:09:36 2019 -0700
+++ b/thun/gnu-prolog/defs.txt	Sun Aug 18 12:17:37 2019 -0700
@@ -22,6 +22,7 @@
 dupdipd == dup dipd
 enstacken == stack [clear] dip
 flatten == [] swap [concat] step
+fork == [i] app2
 fourth == rest third
 gcd == true [tuck mod dup 0 >] loop pop
 grabN == [] swap [cons] times
diff -r e0100f4a11e4 -r d21c31c27003 thun/gnu-prolog/fork.pl
--- a/thun/gnu-prolog/fork.pl	Sun Aug 18 11:09:36 2019 -0700
+++ b/thun/gnu-prolog/fork.pl	Sun Aug 18 12:17:37 2019 -0700
@@ -11,27 +11,23 @@
     fork_prolog(ChildPID),
     bar(ChildPID, In, Out, Expr, Stack).
 
-bar(0, In, Out, Expr, Stack) :-
-    close(In),
+bar(0, In, Out, Expr, Stack) :- close(In),
     thun(Expr, Stack, [Result|_]),
-    w(Out, Result),
-    close(Out),
+    w(Out, Result), close(Out),
     halt.
 
 bar(PID, _, Out, _, _) :-
-    integer(PID),
-    PID =\= 0,
+    integer(PID), PID =\= 0,
     close(Out).
 
 read_pipe(In, Result) :-
     select([In], R, [], _, 1500),
-    (R=[In] ->
-        read(In, Result)
-    ;
-        Result=timeout
-    ),
+    read_pipe_(R, In, Result),
     close(In).
 
+read_pipe_([In], In,  Result) :- read(In, Result).
+read_pipe_(  [],  _, timeout).
+
 mkpipe(In, Out) :-
     create_pipe(In, Out),
     set_stream_buffering(Out, none),



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