aboutsummaryrefslogtreecommitdiff
path: root/sample/gcd_another.in
blob: e616e28178808922f154b60839693730376bc8cd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// Greatest common divisor
//
//def gcd(a: Int, b: Int): Int =
//  if (b==0) a else gcd(b, a%b)


// Rule
gcd(ret) >< (int a, int b)
| b==0 => ret ~ a
| _ => gcd(ret) ~ (b, a%b);

// Net
gcd(r) ~ (14,21);
r; // it should be 7