Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,19 @@
with Ada.Text_IO; use Ada.Text_IO;
procedure Sudan_Function is
function F (N, X, Y : Natural) return Natural
is (if N = 0 then X + Y
elsif Y = 0 then X
else F (N => N - 1,
X => F (N, X, Y - 1),
Y => F (N, X, Y - 1) + Y));
begin
Put_Line ("F0 (0, 0) = " & F (0, 0, 0)'Image);
Put_Line ("F1 (1, 1) = " & F (1, 1, 1)'Image);
Put_Line ("F1 (3, 3) = " & F (1, 3, 3)'Image);
Put_Line ("F2 (1, 1) = " & F (2, 1, 1)'Image);
Put_Line ("F2 (2, 1) = " & F (2, 2, 1)'Image);
Put_Line ("F3 (1, 1) = " & F (3, 1, 1)'Image);
end Sudan_Function;

View file

@ -0,0 +1,11 @@
main :: [sys_message]
main = [Stdout (lay (map test tests))]
where test (n,x,y) = "F" ++ show n ++ "(" ++ show x ++ ","
++ show y ++ ") = " ++ show (f n x y)
tests = [(0,0,0), (1,1,1), (1,3,3),
(2,1,1), (2,2,1), (3,1,1)]
f :: num->num->num->num
f 0 x y = x+y
f (n+1) x 0 = x, if n >= 0
f (n+1) x (y+1) = f n k (k + y + 1), if n >= 0 where k = f (n+1) x y

View file

@ -0,0 +1,25 @@
local fmt = require "fmt"
local function F(n, x, y)
if n == 0 then return x + y end
if y == 0 then return x end
return F(n - 1, F(n, x, y - 1), F(n, x, y - 1) + y)
end
for n = 0, 1 do
print($"Values of F({n}, x, y):")
print("y/x 0 1 2 3 4 5")
print("----------------------------")
for y = 0, 6 do
io.write($"{y} |")
for x = 0, 5 do
local sudan = F(n, x, y)
fmt.write("%4d", sudan)
end
print()
end
print()
end
print($"F(2, 1, 1) = {F(2, 1, 1)}")
print($"F(3, 1, 1) = {F(3, 1, 1)}")
print($"F(2, 2, 1) = {F(2, 2, 1)}")

View file

@ -0,0 +1,5 @@
S ← |3 memo⍣(
⋅+ ⟜°0
| ⋅⊙◌ ◡⋅⋅°0
| S⊃(-1|S⊙⊙-₁|+S⊸(⊙⊙-₁)))
≡(&p$"_ _"⟜(S°⊟₃)) [0_0_0 1_1_1 2_1_1 3_1_1 2_2_1]