Mutual recursion: Difference between revisions
Content added Content deleted
m (→{{header|REXX}}: used clear version of parse (for arg), broke some long line up, added whitespace.) |
m (→{{header|REXX}}: added more whitespace to output notes.) |
||
Line 1,741: | Line 1,741: | ||
Jw: return right(arg(1),length(lim)) /*right justifies # for nice look*/ |
Jw: return right(arg(1),length(lim)) /*right justifies # for nice look*/ |
||
</lang> |
</lang> |
||
'''output''' |
'''output''' using the default input of: <tt> 40 </tt> |
||
<pre style="height:30ex"> |
<pre style="height:30ex"> |
||
F( 0) = 1 M( 0) = 0 |
F( 0) = 1 M( 0) = 0 |
||
Line 1,803: | Line 1,803: | ||
M: procedure expose hm. hf.; parse arg n; if hm.n=='' then hm.n=n-F(M(n-1)); return hm.n |
M: procedure expose hm. hf.; parse arg n; if hm.n=='' then hm.n=n-F(M(n-1)); return hm.n |
||
Jw: return right(arg(1),length(lim)) /*right justifies # for nice look*/</lang> |
Jw: return right(arg(1),length(lim)) /*right justifies # for nice look*/</lang> |
||
'''output''' |
'''output''' using the default input of: <tt> 99 </tt> |
||
<pre> |
<pre> |
||
Js= 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
Js= 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
||
Line 1,831: | Line 1,831: | ||
M: procedure expose hm. hf.; parse arg n; if hm.n=='' then hm.n=n-F(M(n-1)); return hm.n |
M: procedure expose hm. hf.; parse arg n; if hm.n=='' then hm.n=n-F(M(n-1)); return hm.n |
||
Jw: return right(arg(1),length(lim)) /*right justifies # for nice look*/</lang> |
Jw: return right(arg(1),length(lim)) /*right justifies # for nice look*/</lang> |
||
'''output''' using the input of: <tt> -70000 </tt> |
'''output''' using the input of: <tt> -70000 </tt> |
||
<pre> |
<pre> |
||
J(70000)= 70000 |
J(70000)= 70000 |
||
Line 1,837: | Line 1,837: | ||
M(70000)= 43262 |
M(70000)= 43262 |
||
</pre> |
</pre> |
||
'''output''' using the input of a ¼ million: <tt> -250000 </tt> |
'''output''' using the input of a ¼ million: <tt> -250000 </tt> |
||
<pre> |
<pre> |
||
J(250000)= 250000 |
J(250000)= 250000 |