X-Git-Url: https://git.deb.at/?p=debienna.git;a=blobdiff_plain;f=FactTailCall%2Findex.mdwn;h=8b743cc2512cc427c05be883e452e34b62a4797d;hp=d2e028eb96d9f092f1e0440ff7d44d1100295424;hb=096ccad2de573f503e177bb76164614337f92da3;hpb=bb58b440ee60e34e1c961060195598787087c131 diff --git a/FactTailCall/index.mdwn b/FactTailCall/index.mdwn index d2e028e..8b743cc 100644 --- a/FactTailCall/index.mdwn +++ b/FactTailCall/index.mdwn @@ -1,32 +1,32 @@ -FactTailCall hier beschreiben... - -{{{ -import sys - -def fact(x): - ##print 'entered fact ', x - if x==1: - result= 1 - else: - result= fact (x-1)*x - print 'leaving fact ', result - return result - - -def fact_tail_call(x,c): - #print 'entered fact_ ', x, ' ', c - if x==1: - print c - raise 'done' - #result= c - else: - result= fact_ (x-1,c*x) - print 'leaving fact_ ', result - return result - -fact (200) -fact_tail_call (200, 1) -}}} - ----- +FactTailCall hier beschreiben... + +{{{ +import sys + +def fact(x): + ##print 'entered fact ', x + if x==1: + result= 1 + else: + result= fact (x-1)*x + print 'leaving fact ', result + return result + + +def fact_tail_call(x,c): + #print 'entered fact_ ', x, ' ', c + if x==1: + print c + raise 'done' + #result= c + else: + result= fact_ (x-1,c*x) + print 'leaving fact_ ', result + return result + +fact (200) +fact_tail_call (200, 1) +}}} + +---- CategoryCodeSnippets \ No newline at end of file