Implement genrec combinator.

This commit is contained in:
Simon Forman 2019-07-15 20:55:41 -07:00
parent 2baf3b89ce
commit 84584a949c
1 changed files with 4 additions and 0 deletions

View File

@ -185,6 +185,10 @@ combo(times, [P, 1|S], S, Ei, Eo) :- append(P, Ei, Eo).
combo(times, [P, N|S], S, Ei, Eo) :- N #>= 2, M #= N - 1, append(P, [M, P, times|Ei], Eo).
combo(times, [_, N|S], S, _, _ ) :- N #< 0, fail.
combo(genrec, [R1, R0, Then, If|S],
[ Else, Then, If|S], E, [ifte|E]) :-
append(R0, [[If, Then, R0, R1, genrec]|R1], Else).
/*
Compiler