Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,28 +0,0 @@
|
|||
with Ada.Text_Io; use Ada.Text_Io;
|
||||
procedure Mutual_Recursion is
|
||||
function M(N : Integer) return Integer;
|
||||
function F(N : Integer) return Integer is
|
||||
begin
|
||||
if N = 0 then
|
||||
return 1;
|
||||
else
|
||||
return N - M(F(N - 1));
|
||||
end if;
|
||||
end F;
|
||||
function M(N : Integer) return Integer is
|
||||
begin
|
||||
if N = 0 then
|
||||
return 0;
|
||||
else
|
||||
return N - F(M(N-1));
|
||||
end if;
|
||||
end M;
|
||||
begin
|
||||
for I in 0..19 loop
|
||||
Put_Line(Integer'Image(F(I)));
|
||||
end loop;
|
||||
New_Line;
|
||||
for I in 0..19 loop
|
||||
Put_Line(Integer'Image(M(I)));
|
||||
end loop;
|
||||
end Mutual_recursion;
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
with Ada.Text_Io; use Ada.Text_Io;
|
||||
procedure Mutual_Recursion is
|
||||
function M(N: Natural) return Natural;
|
||||
function F(N: Natural) return Natural;
|
||||
|
||||
function M(N: Natural) return Natural is
|
||||
(if N = 0 then 0 else N – F(M(N–1)));
|
||||
|
||||
function F(N: Natural) return Natural is
|
||||
(if N =0 then 1 else N – M(F(N–1)));
|
||||
begin
|
||||
for I in 0..19 loop
|
||||
Put_Line(Integer'Image(F(I)));
|
||||
end loop;
|
||||
New_Line;
|
||||
for I in 0..19 loop
|
||||
Put_Line(Integer'Image(M(I)));
|
||||
end loop;
|
||||
|
||||
end Mutual_recursion;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
f: $[n][ if? n=0 -> 1 else -> n-m f n-1 ]
|
||||
m: $[n][ if? n=0 -> 0 else -> n-f m n-1 ]
|
||||
f: $[n][ switch n=0 -> 1 -> n-m f n-1 ]
|
||||
m: $[n][ switch n=0 -> 0 -> n-f m n-1 ]
|
||||
|
||||
loop 0..20 'i [
|
||||
print ["f(" i ")=" f i]
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import system'collections;
|
|||
F = (n => (n == 0) ? 1 : (n - M(F(n-1))) );
|
||||
M = (n => (n == 0) ? 0 : (n - F(M(n-1))) );
|
||||
|
||||
public program()
|
||||
public Program()
|
||||
{
|
||||
var ra := new ArrayList();
|
||||
var rb := new ArrayList();
|
||||
|
|
@ -15,6 +15,6 @@ public program()
|
|||
rb.append(M(i))
|
||||
};
|
||||
|
||||
console.printLine(ra.asEnumerable());
|
||||
console.printLine(rb.asEnumerable())
|
||||
Console.printLine(ra.asEnumerable());
|
||||
Console.printLine(rb.asEnumerable())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
integer idM, idF
|
||||
|
||||
function F(integer n)
|
||||
if n = 0 then
|
||||
return 1
|
||||
else
|
||||
return n - call_func(idM,{F(n-1)})
|
||||
end if
|
||||
end function
|
||||
|
||||
idF = routine_id("F")
|
||||
|
||||
function M(integer n)
|
||||
if n = 0 then
|
||||
return 0
|
||||
else
|
||||
return n - call_func(idF,{M(n-1)})
|
||||
end if
|
||||
end function
|
||||
|
||||
idM = routine_id("M")
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
function F($n) {
|
||||
if ($n -eq 0) { return 1 }
|
||||
return $n - (M (F ($n - 1)))
|
||||
}
|
||||
|
||||
function M($n) {
|
||||
if ($n -eq 0) { return 0 }
|
||||
return $n - (F (M ($n - 1)))
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
REBOL [
|
||||
Title: "Mutual Recursion"
|
||||
URL: http://rosettacode.org/wiki/Mutual_Recursion
|
||||
References: [http://en.wikipedia.org/wiki/Hofstadter_sequence#Hofstadter_Female_and_Male_sequences]
|
||||
]
|
||||
|
||||
f: func [
|
||||
"Female."
|
||||
n [integer!] "Value."
|
||||
] [either 0 = n [1][n - m f n - 1]]
|
||||
|
||||
m: func [
|
||||
"Male."
|
||||
n [integer!] "Value."
|
||||
] [either 0 = n [0][n - f m n - 1]]
|
||||
|
||||
fs: [] ms: [] for i 0 19 1 [append fs f i append ms m i]
|
||||
print ["F:" mold fs crlf "M:" mold ms]
|
||||
Loading…
Add table
Add a link
Reference in a new issue