Mercurial > hg > Applications > Tokio
annotate Examples/multiply/multi2 @ 0:cfb7c6b24319
Initial revision
author | kono |
---|---|
date | Thu, 30 Aug 2007 14:57:44 +0900 |
parents | |
children |
rev | line source |
---|---|
0 | 1 main :- read((In1,In2)), |
2 mult_imp4(In1,In2,M,N,Done), | |
3 #write((Done,M,N)). | |
4 | |
5 mult_imp4(In1,In2,M,N,Done) :- | |
6 #stable(In1),#stable(In2), | |
7 @ ( | |
8 M = In2, | |
9 N = In1, | |
10 Done = 0, | |
11 int1(In1,In2,Done,M,N) | |
12 ). | |
13 | |
14 int1(In1,In2,Done,M,N) :- | |
15 halt(Done=1), | |
16 intN(In2,Done,M,N). | |
17 | |
18 intN(In2,Done,M,N) :- | |
19 @M = M+In2, | |
20 @N = N-1, | |
21 (if N-2=0 then @Done=1 else @Done=0), | |
22 next(intN(In2,Done,M,N)). |