Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
5
Task/Generic-swap/Modula-3/generic-swap-1.mod3
Normal file
5
Task/Generic-swap/Modula-3/generic-swap-1.mod3
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
GENERIC INTERFACE GenericSwap(Elem);
|
||||
|
||||
PROCEDURE Swap(VAR left: Elem.T; VAR right: Elem.T);
|
||||
|
||||
END GenericSwap.
|
||||
11
Task/Generic-swap/Modula-3/generic-swap-2.mod3
Normal file
11
Task/Generic-swap/Modula-3/generic-swap-2.mod3
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
GENERIC MODULE GenericSwap(Elem);
|
||||
|
||||
PROCEDURE Swap(VAR left: Elem.T; VAR right: Elem.T) =
|
||||
VAR temp: Elem.T := left;
|
||||
BEGIN
|
||||
left := right;
|
||||
right := temp;
|
||||
END Swap;
|
||||
|
||||
BEGIN
|
||||
END GenericSwap.
|
||||
1
Task/Generic-swap/Modula-3/generic-swap-3.mod3
Normal file
1
Task/Generic-swap/Modula-3/generic-swap-3.mod3
Normal file
|
|
@ -0,0 +1 @@
|
|||
INTERFACE IntSwap = GenericSwap(Integer) END IntSwap.
|
||||
1
Task/Generic-swap/Modula-3/generic-swap-4.mod3
Normal file
1
Task/Generic-swap/Modula-3/generic-swap-4.mod3
Normal file
|
|
@ -0,0 +1 @@
|
|||
MODULE IntSwap = GenericSwap(Integer) END IntSwap.
|
||||
12
Task/Generic-swap/Modula-3/generic-swap-5.mod3
Normal file
12
Task/Generic-swap/Modula-3/generic-swap-5.mod3
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
MODULE Main;
|
||||
|
||||
IMPORT IntSwap, IO, Fmt;
|
||||
|
||||
VAR left := 10;
|
||||
right := 20;
|
||||
|
||||
BEGIN
|
||||
IO.Put("Left = " & Fmt.Int(left) & "\n");
|
||||
IntSwap.Swap(left, right);
|
||||
IO.Put("Left = " & Fmt.Int(left) & "\n");
|
||||
END Main.
|
||||
Loading…
Add table
Add a link
Reference in a new issue