Anonymous user
Mutual recursion: Difference between revisions
m
→with memoization, specific entry: optimized the 1st DO loop, it's over a magnitude faster.
(→{{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:
w= length(aLim); $m.=.; $m.0= 0; $f.=.; $f.0= 1; Js=; Fs=; Ms=
do j=0 for
Js= Js right(j, w); Fs= Fs right($f.j, w); Ms= Ms right($m.j, w)
end /*j*/
if lim>0 then say 'Js=' Js; else say 'J('aLim")="
if lim>0 then say 'Fs=' Fs; else say 'F('aLim")="
if lim>0 then say 'Ms=' Ms; else say 'M('aLim")="
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
|