Data update

This commit is contained in:
Ingy döt Net 2026-04-30 12:34:36 -04:00
parent 4bb20c9b71
commit cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions

View file

@ -0,0 +1,14 @@
with Ada.Integer_Text_IO;
use Ada.Integer_Text_IO;
procedure For_Each is
A : array (1..5) of Integer := (-1, 0, 1, 2, 3);
begin
for Num in A'Range loop
Put( A (Num) );
end loop;
end For_Each;

View file

@ -0,0 +1,3 @@
for Item of A loop
Put( Item );
end loop;

View file

@ -0,0 +1,25 @@
with Ada.Integer_Text_IO, Ada.Containers.Doubly_Linked_Lists;
use Ada.Integer_Text_IO, Ada.Containers;
procedure Doubly_Linked_List is
package DL_List_Pkg is new Doubly_Linked_Lists (Integer);
use DL_List_Pkg;
procedure Print_Node (Position : Cursor) is
begin
Put (Element (Position));
end Print_Node;
DL_List : List;
begin
DL_List.Append (1);
DL_List.Append (2);
DL_List.Append (3);
-- Iterates through every node of the list.
DL_List.Iterate (Print_Node'Access);
end Doubly_Linked_List;

View file

@ -0,0 +1,25 @@
with Ada.Integer_Text_IO, Ada.Containers.Vectors;
use Ada.Integer_Text_IO, Ada.Containers;
procedure Vector_Example is
package Vector_Pkg is new Vectors (Natural, Integer);
use Vector_Pkg;
procedure Print_Element (Position : Cursor) is
begin
Put (Element (Position));
end Print_Element;
V : Vector;
begin
V.Append (1);
V.Append (2);
V.Append (3);
-- Iterates through every element of the vector.
V.Iterate (Print_Element'Access);
end Vector_Example;

View file

@ -0,0 +1,6 @@
01 things occurs 3.
...
set content of things to ("Apple", "Banana", "Coconut")
perform varying thing as string through things
display thing
end-perform

View file

@ -0,0 +1,2 @@
var food = ["Milk", "Bread", "Butter"];
for f in food do writeln(f);

View file

@ -0,0 +1,8 @@
# each with block
[1, 2, 3].each do |elt|
print elt
end
puts
# each returning an iterator
it = [1, 2, 3].each
print it.next, it.next, it.next, it.next

View file

@ -0,0 +1,2 @@
(dolist (x '(1 2 3 4))
(message "x=%d" x))

View file

@ -0,0 +1,3 @@
(mapc (lambda (x)
(message "x=%d" x))
'(1 2 3 4))

View file

@ -0,0 +1 @@
(cl-loop for x in '(1 2 3 4) do (message "x=%d" x))

View file

@ -0,0 +1,24 @@
include std/console.e
sequence s = {-2,-1,0,1,2} --print elements of a numerical list
for i = 1 to length(s) do
? s[i]
end for
puts(1,'\n')
s = {"Name","Date","Field1","Field2"} -- print elements of a list of 'strings'
for i = 1 to length(s) do
printf(1,"%s\n",{s[i]})
end for
puts(1,'\n')
for i = 1 to length(s) do -- print subelements of elements of a list of 'strings'
for j = 1 to length(s[i]) do
printf(1,"%s\n",s[i][j])
end for
puts(1,'\n')
end for
if getc(0) then end if

View file

@ -0,0 +1,4 @@
var a = [1, 2, 3, 4];
for (i in a)
Sys.println(i);

View file

@ -0,0 +1,2 @@
def list = ['a','b','c','d','e']
list.each{ println it }

View file

@ -0,0 +1,7 @@
$colors = "Black","Blue","Cyan","Gray","Green","Magenta","Red","White","Yellow",
"DarkBlue","DarkCyan","DarkGray","DarkGreen","DarkMagenta","DarkRed","DarkYellow"
foreach ($color in $colors)
{
Write-Host "$color" -ForegroundColor $color
}

View file

@ -0,0 +1,3 @@
let fruits = ["apple", "banana", "coconut"]
Js.Array2.forEach(fruits, f => Js.log(f))

View file

@ -0,0 +1,13 @@
REBOL [
Title: "Loop/Foreach"
URL: http://rosettacode.org/wiki/Loop/Foreach
]
names: [Sork Gun Blues Neds Thirst Fright Catur]
foreach name names [prin join name "day "] print ""
; Rebol also has the 'forall' construct, which provides the rest of
; the list from the current position.
forall names [prin join names/1 "day "] print ""

View file

@ -0,0 +1 @@
for { 1 2 4 } { .print }

View file

@ -0,0 +1,5 @@
items = Array("Apple", "Orange", "Banana")
For Each x In items
WScript.Echo x
Next