diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2023-03-04 22:46:07 +0100 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2023-03-04 22:46:07 +0100 |
| commit | 45c3f81891837820aea7c3dbd45e3bae25fc4c22 (patch) | |
| tree | 1d4619f1d6cb39cb6505f6056ec8b9f6d6aef727 /inst/prelude.pl | |
| parent | 336feaeba099086eec2a7853b3b3e9fc9a822c64 (diff) | |
| download | prlg-45c3f81891837820aea7c3dbd45e3bae25fc4c22.tar.gz prlg-45c3f81891837820aea7c3dbd45e3bae25fc4c22.tar.bz2 | |
small things
Diffstat (limited to 'inst/prelude.pl')
| -rw-r--r-- | inst/prelude.pl | 17 |
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). |
