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,16 @@
function Fib (X: in Integer) return Integer is
function Actual_Fib (N: in Integer) return Integer is
begin
if N < 2 then
return N;
else
return Actual_Fib (N-1) + Actual_Fib (N-2);
end if;
end Actual_Fib;
begin
if X < 0 then
raise Constraint_Error;
else
return Actual_Fib (X);
end if;
end Fib;

View file

@ -0,0 +1,12 @@
(let fib (fun (n) {
(let f (fun (n)
(if (< n 2)
n
(+ (f (- n 1)) (f (- n 2))))))
(f n) }))
(import std.List)
(list:forEach
(list:iota 0 20)
(fun (n) (print (fib n))))

View file

@ -0,0 +1,15 @@
ConsoleWrite(Fibonacci(10) & @CRLF) ; ## USAGE EXAMPLE
ConsoleWrite(Fibonacci(20) & @CRLF) ; ## USAGE EXAMPLE
ConsoleWrite(Fibonacci(30)) ; ## USAGE EXAMPLE
Func Fibonacci($number)
If $number < 0 Then Return "Invalid argument" ; No negative numbers
If $number < 2 Then ; If $number equals 0 or 1
Return $number ; then return that $number
Else ; Else $number equals 2 or more
Return Fibonacci($number - 1) + Fibonacci($number - 2) ; FIBONACCI!
EndIf
EndFunc

View file

@ -0,0 +1,14 @@
def fib (n : Int64)
raise "only positive numbers allowed" if n < 0
# it needs to be declared beforehand to be able to call it
# from inside itself
fib1 = uninitialized Int64 -> Int64
fib1 = -> (n : Int64) {
if n < 2
n
else
fib1[n - 1] + fib1[n - 2]
end
}
fib1[n]
end

View file

@ -0,0 +1,8 @@
local function fib(n)
assert(n >= 0, "Argument must be non-negative.")
local f
f = |m| -> m < 2 ? m : f(m - 1) + f(m - 2)
return f(n)
end
print(fib(36))

View file

@ -0,0 +1 @@
fib: func [n /f][ do f: func [m] [ either m < 2 [m][(f m - 1) + f m - 2]] n]

View file

@ -0,0 +1,9 @@
F ← |1 memo(⨬(+⊃(F-1|F-2)|◌1)⊸<₂)
F ← F
F¯10
F ← (
F ← |1 memo(⨬(+⊃(F-1|F-2)|◌1)⊸<₂)
F
)
F¯10