testcode

parent b9efc830
(use-modules (logic guile-log iso-prolog))
(use-modules (logic guile-log guile-prolog ops))
(use-modules (logic guile-log guile-prolog vm-compiler))
(define f1 #f)
(define-prolog g "
f(N,I,J,S) :-
I < N ->
(
II is I + 1,
JJ is J + I,
f1(N,II,JJ,S)
) ;
S=J
")
(set! f1 g)
(define-prolog f2 "
f2(N,S) :-
recur * lp((I,0),(J,0)),
(
I < N ->
(
II is I + 1,
JJ is J + I,
lp(II,JJ)
) ;
S=J
).
")
(compile-prolog-string "
f3(N,I,J,S) :-
I < N ->
(
II is I + 1,
JJ is J + I,
f3(N,II,JJ,S)
) ;
S=J
")
(define-prolog memb "
memb(X,L) :-
recur * lp((LL,L)),
LL=[A|B],
(
A=X;
lp(B)
).
")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment