Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
30
Task/Currying/Ada/currying-1.ada
Normal file
30
Task/Currying/Ada/currying-1.ada
Normal 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;
|
||||
18
Task/Currying/Ada/currying-2.ada
Normal file
18
Task/Currying/Ada/currying-2.ada
Normal 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;
|
||||
27
Task/Currying/Ada/currying-3.ada
Normal file
27
Task/Currying/Ada/currying-3.ada
Normal 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;
|
||||
Loading…
Add table
Add a link
Reference in a new issue