Mutual recursion: Difference between revisions
Content added Content deleted
(→{{header|Tailspin}}: function can now forward-reference) |
m (→with memoization, specific entry: optimized the 1st DO loop, it's over a magnitude faster.) |
||
Line 2,893: | Line 2,893: | ||
w= length(aLim); $m.=.; $m.0= 0; $f.=.; $f.0= 1; Js=; Fs=; Ms= |
w= length(aLim); $m.=.; $m.0= 0; $f.=.; $f.0= 1; Js=; Fs=; Ms= |
||
do j=0 for |
do j=0 for aLim+1; call F(J); call M(j) |
||
if lim<0 then iterate |
|||
Js= Js right(j, w); Fs= Fs right($f.j, w); Ms= Ms right($m.j, w) |
|||
end /*j*/ |
end /*j*/ |
||
if lim>0 then say 'Js=' Js; else say 'J('aLim")=" |
if lim>0 then say 'Js=' Js; else say 'J('aLim")=" right( aLim, w) |
||
if lim>0 then say 'Fs=' Fs; else say 'F('aLim")=" |
if lim>0 then say 'Fs=' Fs; else say 'F('aLim")=" right($f.aLim, w) |
||
if lim>0 then say 'Ms=' Ms; else say 'M('aLim")=" |
if lim>0 then say 'Ms=' Ms; else say 'M('aLim")=" right($m.aLIM, w) |
||
exit /*stick a fork in it, we're all done. */ |
exit /*stick a fork in it, we're all done. */ |
||
/*──────────────────────────────────────────────────────────────────────────────────────*/ |
/*──────────────────────────────────────────────────────────────────────────────────────*/ |