summaryrefslogtreecommitdiff
path: root/inst/prelude.pl
diff options
context:
space:
mode:
Diffstat (limited to 'inst/prelude.pl')
-rw-r--r--inst/prelude.pl17
1 files changed, 4 insertions, 13 deletions
diff --git a/inst/prelude.pl b/inst/prelude.pl
index cc0c940..34e7853 100644
--- a/inst/prelude.pl
+++ b/inst/prelude.pl
@@ -45,17 +45,8 @@ Ax > Bx :- A is Ax, B is Bx, int2p_lt(B,A).
Ax >= Bx :- A is Ax, B is Bx, int2p_leq(B,A).
zero(Ax) :- A is Ax, int1p_zero(A).
-gcd(X,Y,R) :- writeln(a), fail.
-gcd(X,Y,R) :- writeln(b), zero(Y), !, R=X.
-gcd(X,Y,R) :- writeln(c), X1 is X mod Y, gcd(Y,X1,R).
-gcd(X,Y,R) :- writeln(a), Y > X, writeln(wat), !, gcd(Y,X,R).
-gcd(X,Y,R) :- writeln(b), zero(Y), !, R=X.
-gcd(X,Y,R) :- writeln(c), X1 is X mod Y, gcd(Y,X1,R).
+gcd(X,Y,R) :- Y > X, !, gcd(Y,X,R).
+gcd(X,Y,R) :- zero(Y), !, R=X.
+gcd(X,Y,R) :- X1 is X mod Y, gcd(Y,X1,R).
-test(X) :- writeln(there), zero(X), fail.
-test(X) :- writeln(here).
-
-test :- writeln(a), a=a, !, fail.
-test :- writeln(b).
-
-xxx :- test.
+lcm(X,Y,R) :- gcd(X,Y,GCD), R is X*(Y/GCD).