X-Git-Url: https://git.deb.at/?p=debienna.git;a=blobdiff_plain;f=FactTailCall%2Findex.mdwn;h=2e02adc19ea7f1a527bba7cf52905410fb3df63f;hp=d2e028eb96d9f092f1e0440ff7d44d1100295424;hb=ca25b3973fb6def2723e708318a989f2b9de1cce;hpb=bb58b440ee60e34e1c961060195598787087c131 diff --git a/FactTailCall/index.mdwn b/FactTailCall/index.mdwn index d2e028e..2e02adc 100644 --- a/FactTailCall/index.mdwn +++ b/FactTailCall/index.mdwn @@ -1,32 +1,34 @@ -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 + +[[FactTailCall|FactTailCall]] hier beschreiben... + + +[[!format txt """ +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) +"""]] + + + [[!tag CategoryCodeSnippets]]