UNPKG

418 Btext/coffeescriptView Raw
1# Find the least common multiple of two expressions.
2
3
4
5Eval_lcm = ->
6 p1 = cdr(p1)
7 push(car(p1))
8 Eval()
9 p1 = cdr(p1)
10 while (iscons(p1))
11 push(car(p1))
12 Eval()
13 lcm()
14 p1 = cdr(p1)
15
16lcm = ->
17 prev_expanding = expanding
18 save()
19 yylcm()
20 restore()
21 expanding = prev_expanding
22
23yylcm = ->
24 expanding = 1
25
26 p2 = pop()
27 p1 = pop()
28
29 push(p1)
30 push(p2)
31 gcd()
32
33 push(p1)
34 divide()
35
36 push(p2)
37 divide()
38
39 inverse()
40