conerted moin to mdwn format
[debienna.git] / FactTailCall / index.mdwn
1
2 [[FactTailCall|FactTailCall]] hier beschreiben... 
3
4
5 [[!format txt """
6 import sys
7
8 def fact(x):
9         ##print 'entered fact ', x
10         if x==1:
11                 result= 1
12         else:
13                 result= fact (x-1)*x
14         print 'leaving fact ', result
15         return result
16
17
18 def fact_tail_call(x,c):
19         #print 'entered fact_ ', x, ' ', c
20         if x==1:
21                 print c
22                 raise 'done'
23                 #result= c
24         else:
25                 result= fact_ (x-1,c*x)
26         print 'leaving fact_ ', result
27         return result
28
29 fact (200)
30 fact_tail_call (200, 1)
31 """]]
32
33
34 ---
35
36  [[CategoryCodeSnippets|CategoryCodeSnippets]]