1
1
mirror of https://github.com/anoma/juvix.git synced 2024-11-30 14:13:27 +03:00
juvix/tests/Core/positive/test027.jvc

19 lines
337 B
Plaintext

-- Euclid's algorithm
def gcd := \a \b {
if a > b then
gcd b a
else if a = 0 then
b
else
gcd (b % a) a
};
def writeLn := \x write x >> write "\n";
writeLn (gcd (3 * 7 * 2) (7 * 2)) >>
writeLn (gcd (3 * 7 * 2 * 11 * 5) (7 * 2 * 5)) >>
writeLn (gcd 3 7) >>
writeLn (gcd 7 3) >>
writeLn (gcd (11 * 7 * 3) (2 * 5 * 13))