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 @@
generic
type Argument_1 (<>) is limited private;
type Argument_2 (<>) is limited private;
type Argument_3 (<>) is limited private;
type Return_Value (<>) is limited private;
with function Func
(A : in Argument_1;
B : in Argument_2;
C : in Argument_3)
return Return_Value;
package Curry_3 is
generic
First : in Argument_1;
package Apply_1 is
generic
Second : in Argument_2;
package Apply_2 is
function Apply_3
(Third : in Argument_3)
return Return_Value;
end Apply_2;
end Apply_1;
end Curry_3;

View file

@ -0,0 +1,18 @@
package body Curry_3 is
package body Apply_1 is
package body Apply_2 is
function Apply_3
(Third : in Argument_3)
return Return_Value is
begin
return Func (First, Second, Third);
end Apply_3;
end Apply_2;
end Apply_1;
end Curry_3;

View file

@ -0,0 +1,27 @@
with Curry_3, Ada.Text_IO;
procedure Curry_Test is
function Sum
(X, Y, Z : in Integer)
return Integer is
begin
return X + Y + Z;
end Sum;
package Curried is new Curry_3
(Argument_1 => Integer,
Argument_2 => Integer,
Argument_3 => Integer,
Return_Value => Integer,
Func => Sum);
package Sum_5 is new Curried.Apply_1 (5);
package Sum_5_7 is new Sum_5.Apply_2 (7);
Result : Integer := Sum_5_7.Apply_3 (3);
begin
Ada.Text_IO.Put_Line ("Five plus seven plus three is" & Integer'Image (Result));
end Curry_Test;

View file

@ -0,0 +1 @@
function Add($x) { return { param($y) return $y + $x }.GetNewClosure() }

View file

@ -0,0 +1 @@
& (Add 1) 2

View file

@ -0,0 +1 @@
(4,9,16,25 | ForEach-Object { & (add $_) ([Math]::Sqrt($_)) }) -join ", "

View file

@ -0,0 +1,19 @@
;; Based on the Red language solution bellow.
make-curry: func[
"Define a custome simple currying function"
'fn [word!]
x
][
do compose/deep [
func [
(reform ["currying function:" form fn x "y"])
y
][ do compose [(get fn) (x) y]]
]
]
add2: make-curry add 2
add3: make-curry add 3
print add2 7
print add3 7
print "^/Help output:"
help add3