Data update

This commit is contained in:
Ingy döt Net 2026-02-01 16:33:20 -08:00
parent 5150844a7d
commit 4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions

View file

@ -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;

View file

@ -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);

View file

@ -1,4 +1,4 @@
swap: function [a,b].exportable [
swap: function [a,b].inline [
tmp: var b
let b var a
let a tmp

View file

@ -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.

View file

@ -1 +0,0 @@
a <=> b

View file

@ -1 +0,0 @@
(a, b) = (b, a)

View file

@ -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)
}

View file

@ -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)

View file

@ -1,2 +0,0 @@
(defmacro swap (a b)
`(setq ,b (prog1 ,a (setq ,a ,b))))

View file

@ -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)

View file

@ -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})

View file

@ -1 +0,0 @@
$b, $a = $a, $b

View file

@ -1,3 +0,0 @@
function swap ([ref] $a, [ref] $b) {
$a.Value, $b.Value = $b.Value, $a.Value
}

View file

@ -1 +0,0 @@
swap ([ref] $a) ([ref] $b)

View file

@ -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 "."]

View file

@ -1,6 +0,0 @@
sub swap( byref x, byref y )
dim temp
temp = x
x = y
y = temp
end sub

View file

@ -1,7 +0,0 @@
dim a
a = "woof"
dim b
b = now()
swap a,b
wscript.echo a
wscript.echo b

View file

@ -1,2 +0,0 @@
5/02/2010 2:35:36 PM
woof