2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -1,10 +1,10 @@
/*REXX program shows mutual recursion (via Hofstadter Male & Female sequence).*/
parse arg lim .; if lim='' then lim=40; w=length(lim); pad=left('',20)
/*REXX program shows mutual recursion (via the Hofstadter Male and Female sequences). */
parse arg lim .; if lim='' then lim=40; w=length(lim); pad=left('', 20)
do j=0 to lim; jj=right(j,w); ff=right(F(j),w); mm=right(M(j),w)
say pad 'F('jj") =" ff pad 'M('jj") =" mm
do j=0 to lim; jj=right(j, w); ff=right(F(j), w); mm=right(M(j), w)
say pad 'F('jj") =" ff pad 'M('jj") =" mm
end /*j*/
exit /*stick a fork in it, we're all done. */
/*────────────────────────────────────────────────────────────────────────────*/
F: procedure; parse arg n; if n==0 then return 1; return n - M(F(n-1))
M: procedure; parse arg n; if n==0 then return 0; return n - F(M(n-1))
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
F: procedure; parse arg n; if n==0 then return 1; return n - M( F(n-1) )
M: procedure; parse arg n; if n==0 then return 0; return n - F( M(n-1) )

View file

@ -1,14 +1,14 @@
/*REXX program shows mutual recursion (via Hofstadter Male & Female sequence).*/
parse arg lim .; if lim=='' then lim=40 /*assume the default for LIM? */
w=length(lim); $m.=.; $m.0=0; $f.=.; $f.0=1; Js=; Fs=; Ms=
/*REXX program shows mutual recursion (via the Hofstadter Male and Female sequences). */
parse arg lim .; if lim=='' then lim=40 /*assume the default for LIM? */
w=length(lim); $m.=.; $m.0=0; $f.=.; $f.0=1; Js=; Fs=; Ms=
do j=0 to lim
Js=Js right(j,w); Fs=Fs right(F(j),w); Ms=Ms right(M(j),w)
Js=Js right(j, w); Fs=Fs right(F(j), w); Ms=Ms right(M(j), w)
end /*j*/
say 'Js=' Js /*display the list of Js to the term.*/
say 'Fs=' Fs /* " " " " Fs " " " */
say 'Ms=' Ms /* " " " " Ms " " " */
exit /*stick a fork in it, we're all done. */
/*───────────────────────────────────────────────────────────────────────────────────*/
F: procedure expose $m. $f.; parse arg n; if $f.n==. then $f.n=n-M(F(n-1)); return $f.n
M: procedure expose $m. $f.; parse arg n; if $m.n==. then $m.n=n-F(M(n-1)); return $m.n
say 'Js=' Js /*display the list of Js to the term.*/
say 'Fs=' Fs /* " " " " Fs " " " */
say 'Ms=' Ms /* " " " " Ms " " " */
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
F: procedure expose $m. $f.; parse arg n; if $f.n==. then $f.n=n-M(F(n-1)); return $f.n
M: procedure expose $m. $f.; parse arg n; if $m.n==. then $m.n=n-F(M(n-1)); return $m.n

View file

@ -1,17 +1,17 @@
/*REXX program shows mutual recursion (via Hofstadter Male & Female sequence).*/
/*────────If LIM is negative, a single result is shown for the abs(lim) entry.*/
/*REXX program shows mutual recursion (via the Hofstadter Male and Female sequences). */
/*───────────────── If LIM is negative, a single result is shown for the abs(lim) entry.*/
parse arg lim .; if lim=='' then lim=99; aLim=abs(lim)
w=length(aLim); $m.=.; $m.0=0; $f.=.; $f.0=1; Js=; Fs=; Ms=
parse arg lim .; if lim=='' then lim=99; aLim=abs(lim)
w=length(aLim); $m.=.; $m.0=0; $f.=.; $f.0=1; Js=; Fs=; Ms=
do j=0 to Alim
Js=Js right(j,w); Fs=Fs right(F(j),w); Ms=Ms right(M(j),w)
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")=" word(Js,aLim+1)
if lim>0 then say 'Fs=' Fs; else say 'F('aLim")=" word(Fs,aLim+1)
if lim>0 then say 'Ms=' Ms; else say 'M('aLim")=" word(Ms,aLim+1)
exit /*stick a fork in it, we're all done. */
/*───────────────────────────────────────────────────────────────────────────────────*/
F: procedure expose $m. $f.; parse arg n; if $f.n==. then $f.n=n-M(F(n-1)); return $f.n
M: procedure expose $m. $f.; parse arg n; if $m.n==. then $m.n=n-F(M(n-1)); return $m.n
if lim>0 then say 'Js=' Js; else say 'J('aLim")=" word(Js, aLim+1)
if lim>0 then say 'Fs=' Fs; else say 'F('aLim")=" word(Fs, aLim+1)
if lim>0 then say 'Ms=' Ms; else say 'M('aLim")=" word(Ms, aLim+1)
exit /*stick a fork in it, we're all done. */
/*──────────────────────────────────────────────────────────────────────────────────────*/
F: procedure expose $m. $f.; parse arg n; if $f.n==. then $f.n=n-M(F(n-1)); return $f.n
M: procedure expose $m. $f.; parse arg n; if $m.n==. then $m.n=n-F(M(n-1)); return $m.n