June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
20
Task/Mutual-recursion/Elena/mutual-recursion.elena
Normal file
20
Task/Mutual-recursion/Elena/mutual-recursion.elena
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import extensions.
|
||||
import system'collections.
|
||||
|
||||
F = (:n)((n == 0) ifTrue:[^1] ifFalse:[ ^n - (M(F(n-1))) ] ).
|
||||
M = (:n)((n == 0) ifTrue:[^0] ifFalse:[ ^n - (F(M(n-1))) ] ).
|
||||
|
||||
program =
|
||||
[
|
||||
var ra := ArrayList new.
|
||||
var rb := ArrayList new.
|
||||
|
||||
0 to:19 do(:i)
|
||||
[
|
||||
ra append(F eval:i).
|
||||
rb append(M eval:i).
|
||||
].
|
||||
|
||||
console printLine(ra).
|
||||
console printLine(rb).
|
||||
].
|
||||
17
Task/Mutual-recursion/Maple/mutual-recursion.maple
Normal file
17
Task/Mutual-recursion/Maple/mutual-recursion.maple
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
female_seq := proc(n)
|
||||
if (n = 0) then
|
||||
return 1;
|
||||
else
|
||||
return n - male_seq(female_seq(n-1));
|
||||
end if;
|
||||
end proc;
|
||||
|
||||
male_seq := proc(n)
|
||||
if (n = 0) then
|
||||
return 0;
|
||||
else
|
||||
return n - female_seq(male_seq(n-1));
|
||||
end if;
|
||||
end proc;
|
||||
seq(female_seq(i), i=0..10);
|
||||
seq(male_seq(i), i=0..10);
|
||||
Loading…
Add table
Add a link
Reference in a new issue