[Joypy-announce] joypy/Joypy: `primrec` combinator in Prolog

Zurück zum Archiv-Index
scmno****@osdn***** scmno****@osdn*****
Wed May 6 07:52:50 JST 2020


changeset a42357f12ac7 in joypy/Joypy
details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=a42357f12ac7
user: Simon Forman <sform****@hushm*****>
date: Tue May 05 15:52:40 2020 -0700
description: `primrec` combinator in Prolog

Ticket #40375

diffstat:

 thun/thun.pl |  9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diffs (19 lines):

diff -r 005ce04ac54f -r a42357f12ac7 thun/thun.pl
--- a/thun/thun.pl	Tue May 05 15:22:12 2020 -0700
+++ b/thun/thun.pl	Tue May 05 15:52:40 2020 -0700
@@ -372,6 +372,15 @@
               [  Else, Then, If|S], E, [ifte|E]) :-
     append(R0, [[If, Then, R0, R1, symbol(genrec)]|R1], Else).
 
+combo(primrec, [list(_), list(B), int(N)|S], S, E, Eo) :-
+    N #=< 0,
+    append(B, E, Eo).
+combo(primrec, [list(R), list(B), int(N)        |S],
+               [list(R), list(B), int(M), int(N)|S], E, Eo) :-
+    N #> 0,
+    M #= N - 1,
+    append([symbol(primrec)|R], E, Eo).
+
 /*
 This is a crude but servicable implementation of the map combinator.
 



More information about the Joypy-announce mailing list
Zurück zum Archiv-Index