Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,47 @@
class
APPLICATION
create
make
feature
make
-- Test of the mutually recursive functions Female and Male.
do
across
0 |..| 19 as c
loop
io.put_string (Female (c.item).out + " ")
end
io.new_line
across
0 |..| 19 as c
loop
io.put_string (Male (c.item).out + " ")
end
end
Female (n: INTEGER): INTEGER
-- Female sequence of the Hofstadter Female and Male sequences.
require
n_not_negative: n >= 0
do
Result := 1
if n /= 0 then
Result := n - Male (Female (n - 1))
end
end
Male (n: INTEGER): INTEGER
-- Male sequence of the Hofstadter Female and Male sequences.
require
n_not_negative: n >= 0
do
Result := 0
if n /= 0 then
Result := n - Female (Male (n - 1))
end
end
end