Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
|
|
@ -0,0 +1,19 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
with Ada.Containers.Indefinite_Ordered_Maps;
|
||||
|
||||
procedure Test_Iteration is
|
||||
package String_Maps is
|
||||
new Ada.Containers.Indefinite_Ordered_Maps (String, Integer);
|
||||
use String_Maps;
|
||||
A : Map;
|
||||
Index : Cursor;
|
||||
begin
|
||||
A.Insert ("hello", 1);
|
||||
A.Insert ("world", 2);
|
||||
A.Insert ("!", 3);
|
||||
Index := A.First;
|
||||
while Index /= No_Element loop
|
||||
Put_Line (Key (Index) & Integer'Image (Element (Index)));
|
||||
Index := Next (Index);
|
||||
end loop;
|
||||
end Test_Iteration;
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
local proc f1(x) print(x); return x end
|
||||
|
||||
# t is a constant table, its contents can change but t itself cannot be assigned to
|
||||
local constant t := [ "foo" ~ "bar"
|
||||
, "baz" ~ 6
|
||||
, fortytwo ~ 7
|
||||
, 42 ~ [ 1, 2, 3 ]
|
||||
, "zz" ~ f1
|
||||
];
|
||||
t[ f1 ] := true; # keys that aren't strings or numbers need to be added via assignments
|
||||
|
||||
for key, val in pairs( t ) do
|
||||
printf( "%24s (%9s) -> (%9s) %-24s \n", key, type( key ), type( val ), val )
|
||||
od
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
var A = [ "H2O" => "water", "NaCl" => "salt", "O2" => "oxygen" ];
|
||||
|
||||
for k in A.domain do
|
||||
writeln("have key: ", k);
|
||||
|
||||
for v in A do
|
||||
writeln("have value: ", v);
|
||||
|
||||
for (k,v) in zip(A.domain, A) do
|
||||
writeln("have element: ", k, " -> ", v);
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
(fn f1 [x] (print x) x)
|
||||
|
||||
(local t { "foo" "bar"
|
||||
"baz" 6
|
||||
:fortytwo 7 ; :fortytwo is equivalent to "fortytwo"
|
||||
42 [ 1 2 3 ]
|
||||
f1 true
|
||||
"zz" f1
|
||||
}
|
||||
)
|
||||
(each [key val (pairs t)]
|
||||
(print (string.format "%28s (%9s) -> (%9s) %s" key (type key) (type val) val))
|
||||
)
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
class Main {
|
||||
static public function main() {
|
||||
var map = [1 => "one", 2 => "two"];
|
||||
|
||||
// key and value
|
||||
for (key => value in map) {
|
||||
trace(key + " " + value);
|
||||
}
|
||||
|
||||
// keys only
|
||||
for (key in map.keys())
|
||||
trace(key);
|
||||
|
||||
// values only
|
||||
for (value in map)
|
||||
trace(value);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
def assoc = [a:1, b:2, c:3]
|
||||
assoc.each{ println it }
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
['a', 1]
|
||||
['b', 2]
|
||||
['c', 3]
|
||||
|
|
@ -0,0 +1 @@
|
|||
assoc.each{ k,v -> println "key:$k, value:$v" }
|
||||
|
|
@ -0,0 +1 @@
|
|||
assoc.each{ k,v -> println k }
|
||||
|
|
@ -0,0 +1 @@
|
|||
assoc.each{ k,v -> println v }
|
||||
|
|
@ -0,0 +1 @@
|
|||
$h = @{ 'a' = 1; 'b' = 2; 'c' = 3 }
|
||||
|
|
@ -0,0 +1 @@
|
|||
$h.GetEnumerator() | ForEach-Object { Write-Host Key: $_.Name, Value: $_.Value }
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
foreach ($e in $h.GetEnumerator()) {
|
||||
Write-Host Key: $e.Name, Value: $e.Value
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
$h.Keys | ForEach-Object { Write-Host Key: $_ }
|
||||
|
||||
foreach ($k in $h.Keys) {
|
||||
Write-Host Key: $k
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
$h.Values | ForEach-Object { Write-Host Value: $_ }
|
||||
|
||||
foreach ($v in $h.Values) {
|
||||
Write-Host Value: $v
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
-- 23 Aug 2025
|
||||
-- 21 Feb 2026
|
||||
include Setting
|
||||
|
||||
say 'ASSOCIATIVE ARRAY: ITERATION'
|
||||
|
|
@ -47,7 +47,7 @@ do w = 1 to arra.0
|
|||
end
|
||||
say
|
||||
-- Show all vars
|
||||
call DumpVariables
|
||||
call Showvars
|
||||
exit
|
||||
|
||||
SetStateCap:
|
||||
|
|
@ -61,4 +61,5 @@ list=list code
|
|||
w=w+1; arra.w=code
|
||||
return
|
||||
|
||||
-- Showvars
|
||||
include Math
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
'instantiate the dictionary object
|
||||
Set dict = CreateObject("Scripting.Dictionary")
|
||||
|
||||
'populate the dictionary or hash table
|
||||
dict.Add 1,"larry"
|
||||
dict.Add 2,"curly"
|
||||
dict.Add 3,"moe"
|
||||
|
||||
'iterate key and value pairs
|
||||
For Each key In dict.Keys
|
||||
WScript.StdOut.WriteLine key & " - " & dict.Item(key)
|
||||
Next
|
||||
Loading…
Add table
Add a link
Reference in a new issue