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,64 +0,0 @@
with Ada.Text_IO;
with Ada.Strings.Unbounded;
procedure Sort_Three is
generic
type Element_Type is private;
with function "<" (Left, Right : in Element_Type) return Boolean;
procedure Generic_Sort (X, Y, Z : in out Element_Type);
procedure Generic_Sort (X, Y, Z : in out Element_Type)
is
procedure Swap (Left, Right : in out Element_Type) is
T : constant Element_Type := Left;
begin
Left := Right;
Right := T;
end Swap;
begin
if Y < X then Swap (X, Y); end if;
if Z < Y then Swap (Y, Z); end if;
if Y < X then Swap (X, Y); end if;
end Generic_Sort;
procedure Test_Unbounded_Sort is
use Ada.Text_IO;
use Ada.Strings.Unbounded;
X : Unbounded_String := To_Unbounded_String ("lions, tigers, and");
Y : Unbounded_String := To_Unbounded_String ("bears, oh my!");
Z : Unbounded_String := To_Unbounded_String ("(from the ""Wizard of OZ"")");
procedure Sort is
new Generic_Sort (Unbounded_String, "<");
begin
Sort (X, Y, Z);
Put_Line (To_String (X));
Put_Line (To_String (Y));
Put_Line (To_String (Z));
New_Line;
End Test_Unbounded_Sort;
procedure Test_Integer_Sort is
use Ada.Text_IO;
procedure Sort is
new Generic_Sort (Integer, "<");
X : Integer := 77444;
Y : Integer := -12;
Z : Integer := 0;
begin
Sort (X, Y, Z);
Put_Line (X'Image);
Put_Line (Y'Image);
Put_Line (Z'Image);
New_Line;
end Test_Integer_Sort;
begin
Test_Unbounded_Sort;
Test_Integer_Sort;
end Sort_Three;

View file

@ -1,43 +0,0 @@
program-id. 3var.
data division.
working-storage section.
1 n binary pic 9(4).
1 num pic -(7)9.
1 a1 pic x(32) value "lions, tigers, and".
1 a2 pic x(32) value "bears, oh my!".
1 a3 pic x(32) value "(from the ""Wizard of OZ"")".
1 n1 pic x(8) value "77444".
1 n2 pic x(8) value "-12".
1 n3 pic x(8) value "0".
1 alpha-table.
2 alpha-entry occurs 3 pic x(32).
1 numeric-table.
2 numeric-entry occurs 3 pic s9(8).
1 filler value "x = y = z = ".
2 lead-in occurs 3 pic x(4).
procedure division.
begin.
move a1 to alpha-entry (1)
move a2 to alpha-entry (2)
move a3 to alpha-entry (3)
sort alpha-entry ascending alpha-entry
perform varying n from 1 by 1
until n > 3
display lead-in (n) alpha-entry (n)
end-perform
display space
compute numeric-entry (1) = function numval (n1)
compute numeric-entry (2) = function numval (n2)
compute numeric-entry (3) = function numval (n3)
sort numeric-entry ascending numeric-entry
perform varying n from 1 by 1
until n > 3
move numeric-entry (n) to num
display lead-in (n) num
end-perform
stop run
.
end program 3var.

View file

@ -7,7 +7,7 @@ sortThree(ref object a, ref object b, ref object c)
if (b > c) { exchange(ref b, ref c) }
}
public program()
public Program()
{
var x := 5;
var y := 1;
@ -20,6 +20,6 @@ public program()
sortThree(ref x,ref y,ref z);
sortThree(ref a,ref b,ref c);
console.printLine(x,",",y,",",z);
console.printLine(a,",",b,",",c)
Console.printLine(x,",",y,",",z);
Console.printLine(a,",",b,",",c)
}

View file

@ -1,4 +0,0 @@
#lang R
assignVec <- Vectorize("assign", c("x", "value"))
`%<<-%` <- function(x, value) invisible(assignVec(x, value, envir = .GlobalEnv)) # define multiple global assignments operator

View file

@ -1,26 +0,0 @@
x <- 'lions, tigers, and'
y <- 'bears, oh my!'
z <- '(from the "Wizard of OZ")'
c("x", "y", "z") %<<-% sort(c(x, y, z))
x
## [1] "(from the \"Wizard of OZ\")"
y
## [1] "bears, oh my!"
z
## [1] "lions, tigers, and"
x <- 77444
y <- -12
z <- 0
c("x", "y", "z") %<<-% sort(c(x, y, z))
x
## [1] -12
y
## [1] 0
z
## [1] 77444

View file

@ -1,5 +1,3 @@
#lang racket
(define-syntax-rule (sort-3! x y z <?)
(begin
(define-syntax-rule (swap! x y) (let ((tmp x)) (set! x y) (set! y tmp)))