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,30 @@
with Ada.Text_IO;
procedure Value_Capture is
protected type Fun is -- declaration of the type of a protected object
entry Init(Index: Natural);
function Result return Natural;
private
N: Natural := 0;
end Fun;
protected body Fun is -- the implementation of a protected object
entry Init(Index: Natural) when N=0 is
begin -- after N has been set to a nonzero value, it cannot be changed any more
N := Index;
end Init;
function Result return Natural is (N*N);
end Fun;
A: array (1 .. 10) of Fun; -- an array holding 10 protected objects
begin
for I in A'Range loop -- initialize the protected objects
A(I).Init(I);
end loop;
for I in A'First .. A'Last-1 loop -- evaluate the functions, except for the last
Ada.Text_IO.Put(Integer'Image(A(I).Result));
end loop;
end Value_Capture;

View file

@ -0,0 +1,7 @@
;; -*- lexical-binding: t; -*-
(mapcar #'funcall
(mapcar (lambda (x)
(lambda ()
(* x x)))
'(1 2 3 4 5 6 7 8 9 10)))
;; => (1 4 9 16 25 36 49 64 81 100)

View file

@ -0,0 +1,2 @@
def f = 10.map{ i -> { -> i * i } }
println f[5]()

View file

@ -0,0 +1,8 @@
local fs = table.create(10)
for i = 1, 10 do
fs[i] = || -> i * i
end
for i = 1, #fs - 1 do
print($"Function #{i}: {fs[i]()}")
end

View file

@ -0,0 +1,4 @@
function Get-Closure ([double]$Number)
{
{param([double]$Sum) return $script:Number *= $Sum}.GetNewClosure()
}

View file

@ -0,0 +1,9 @@
for ($i = 1; $i -lt 11; $i++)
{
$total = Get-Closure -Number $i
[PSCustomObject]@{
Function = $i
Sum = & $total -Sum $i
}
}

View file

@ -0,0 +1,11 @@
$numbers = 1..20 | Get-Random -Count 10
foreach ($number in $numbers)
{
$total = Get-Closure -Number $number
[PSCustomObject]@{
Function = $number
Sum = & $total -Sum $number
}
}

View file

@ -0,0 +1,2 @@
funs: collect [repeat i 10 [keep func [] reduce [i ** 2]]]
funs/7