Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,10 +0,0 @@
|
|||
generic
|
||||
type Swap_Type is private; -- Generic parameter
|
||||
procedure Generic_Swap (Left, Right : in out Swap_Type);
|
||||
|
||||
procedure Generic_Swap (Left, Right : in out Swap_Type) is
|
||||
Temp : constant Swap_Type := Left;
|
||||
begin
|
||||
Left := Right;
|
||||
Right := Temp;
|
||||
end Generic_Swap;
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
with Generic_Swap;
|
||||
...
|
||||
type T is ...
|
||||
procedure T_Swap is new Generic_Swap (Swap_Type => T);
|
||||
A, B : T;
|
||||
...
|
||||
T_Swap (A, B);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
swap: function [a,b].exportable [
|
||||
swap: function [a,b].inline [
|
||||
tmp: var b
|
||||
let b var a
|
||||
let a tmp
|
||||
|
|
|
|||
|
|
@ -1,74 +0,0 @@
|
|||
PROGRAM-ID. SWAP-DEMO.
|
||||
AUTHOR. Bill Gunshannon.
|
||||
INSTALLATION. Home.
|
||||
DATE-WRITTEN. 16 December 2021.
|
||||
************************************************************
|
||||
** Program Abstract:
|
||||
** A simple program to demonstrate the SWAP subprogram.
|
||||
**
|
||||
************************************************************
|
||||
|
||||
DATA DIVISION.
|
||||
|
||||
WORKING-STORAGE SECTION.
|
||||
|
||||
01 Val1 PIC X(72).
|
||||
01 Val2 PIC X(72).
|
||||
|
||||
PROCEDURE DIVISION.
|
||||
|
||||
Main-Program.
|
||||
|
||||
DISPLAY 'Enter a Value: ' WITH NO ADVANCING.
|
||||
ACCEPT Val1.
|
||||
DISPLAY 'Enter another Value: ' WITH NO ADVANCING.
|
||||
ACCEPT Val2.
|
||||
DISPLAY ' ' .
|
||||
DISPLAY 'First value: ' FUNCTION TRIM(Val1) .
|
||||
DISPLAY 'Second value: ' FUNCTION TRIM(Val2) .
|
||||
|
||||
CALL "SWAP" USING BY REFERENCE Val1, BY REFERENCE Val2.
|
||||
|
||||
DISPLAY ' '.
|
||||
DISPLAY 'After SWAP '.
|
||||
DISPLAY ' '.
|
||||
DISPLAY 'First value: ' FUNCTION TRIM(Val1).
|
||||
DISPLAY 'Second value: ' FUNCTION TRIM(Val2).
|
||||
|
||||
STOP RUN.
|
||||
|
||||
END PROGRAM SWAP-DEMO.
|
||||
|
||||
IDENTIFICATION DIVISION.
|
||||
PROGRAM-ID. SWAP.
|
||||
AUTHOR. Bill Gunshannon.
|
||||
INSTALLATION. Home.
|
||||
DATE-WRITTEN. 16 December 2021.
|
||||
************************************************************
|
||||
** Program Abstract:
|
||||
** SWAP any Alphanumeric value. Only limit is 72
|
||||
** character size. But that can be adjusted for
|
||||
** whatever use one needs.
|
||||
************************************************************
|
||||
|
||||
DATA DIVISION.
|
||||
|
||||
WORKING-STORAGE SECTION.
|
||||
|
||||
01 TEMP PIC X(72).
|
||||
|
||||
LINKAGE SECTION.
|
||||
|
||||
01 Field1 PIC X(72).
|
||||
01 Field2 PIC X(72).
|
||||
|
||||
PROCEDURE DIVISION
|
||||
USING BY REFERENCE Field1, BY REFERENCE Field2.
|
||||
|
||||
MOVE Field1 to TEMP.
|
||||
MOVE Field2 to Field1.
|
||||
MOVE TEMP to Field2.
|
||||
|
||||
GOBACK.
|
||||
|
||||
END PROGRAM SWAP.
|
||||
|
|
@ -1 +0,0 @@
|
|||
a <=> b
|
||||
|
|
@ -1 +0,0 @@
|
|||
(a, b) = (b, a)
|
||||
|
|
@ -8,14 +8,14 @@ swap(ref object v1, ref object v2)
|
|||
v2 := tmp
|
||||
}
|
||||
|
||||
public program()
|
||||
public Program()
|
||||
{
|
||||
var n := 2;
|
||||
var s := "abc";
|
||||
|
||||
console.printLine(n," ",s);
|
||||
Console.printLine(n," ",s);
|
||||
|
||||
swap(ref n, ref s);
|
||||
|
||||
console.printLine(n," ",s)
|
||||
Console.printLine(n," ",s)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
(defun swap (a-sym b-sym)
|
||||
"Swap values of the variables given by A-SYM and B-SYM."
|
||||
(let ((a-val (symbol-value a-sym)))
|
||||
(set a-sym (symbol-value b-sym))
|
||||
(set b-sym a-val)))
|
||||
(swap 'a 'b)
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
(defmacro swap (a b)
|
||||
`(setq ,b (prog1 ,a (setq ,a ,b))))
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
(require 'cl-lib)
|
||||
(defmacro swap (a b)
|
||||
`(cl-psetf ,a ,b
|
||||
,b ,a))
|
||||
|
||||
(setq lst (list 123 456))
|
||||
(swap (car lst) (cadr lst))
|
||||
;; now lst is '(456 123)
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
include std/console.e -- for display
|
||||
|
||||
object x = 3.14159
|
||||
object y = "Rosettacode"
|
||||
|
||||
{y,x} = {x,y}
|
||||
|
||||
display("x is now []",{x})
|
||||
display("y is now []",{y})
|
||||
|
|
@ -1 +0,0 @@
|
|||
$b, $a = $a, $b
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
function swap ([ref] $a, [ref] $b) {
|
||||
$a.Value, $b.Value = $b.Value, $a.Value
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
swap ([ref] $a) ([ref] $b)
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
REBOL [
|
||||
Title: "Generic Swap"
|
||||
URL: http://rosettacode.org/wiki/Generic_swap
|
||||
Reference: [http://reboltutorial.com/blog/rebol-words/]
|
||||
]
|
||||
|
||||
swap: func [
|
||||
"Swap contents of variables."
|
||||
a [word!] b [word!] /local x
|
||||
][
|
||||
x: get a
|
||||
set a get b
|
||||
set b x
|
||||
]
|
||||
|
||||
answer: 42 ship: "Heart of Gold"
|
||||
swap 'answer 'ship ; Note quoted variables.
|
||||
print rejoin ["The answer is " answer ", the ship is " ship "."]
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
sub swap( byref x, byref y )
|
||||
dim temp
|
||||
temp = x
|
||||
x = y
|
||||
y = temp
|
||||
end sub
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
dim a
|
||||
a = "woof"
|
||||
dim b
|
||||
b = now()
|
||||
swap a,b
|
||||
wscript.echo a
|
||||
wscript.echo b
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
5/02/2010 2:35:36 PM
|
||||
woof
|
||||
Loading…
Add table
Add a link
Reference in a new issue