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,33 +0,0 @@
with Ada.Containers.Ordered_Maps;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Text_IO;
procedure Associative_Array is
-- Instantiate the generic package Ada.Containers.Ordered_Maps
package Associative_Int is new Ada.Containers.Ordered_Maps(Unbounded_String, Integer);
use Associative_Int;
Color_Map : Map;
Color_Cursor : Cursor;
Success : Boolean;
Value : Integer;
begin
-- Add values to the ordered map
Color_Map.Insert(To_Unbounded_String("Red"), 10, Color_Cursor, Success);
Color_Map.Insert(To_Unbounded_String("Blue"), 20, Color_Cursor, Success);
Color_Map.Insert(To_Unbounded_String("Yellow"), 5, Color_Cursor, Success);
-- retrieve values from the ordered map and print the value and key
-- to the screen
Value := Color_Map.Element(To_Unbounded_String("Red"));
Ada.Text_Io.Put_Line("Red:" & Integer'Image(Value));
Value := Color_Map.Element(To_Unbounded_String("Blue"));
Ada.Text_IO.Put_Line("Blue:" & Integer'Image(Value));
Value := Color_Map.Element(To_Unbounded_String("Yellow"));
Ada.Text_IO.Put_Line("Yellow:" & Integer'Image(Value));
end Associative_Array;

View file

@ -1,127 +0,0 @@
; Associative arrays in AutoIt.
; All the required functions are below the examples.
; Initialize an error handler to deal with any COM errors..
global $oMyError = ObjEvent("AutoIt.Error", "AAError")
; first example, simple.
global $simple
; Initialize your array ...
AAInit($simple)
AAAdd($simple, "Appple", "fruit")
AAAdd($simple, "Dog", "animal")
AAAdd($simple, "Silicon", "tetravalent metalloid semiconductor")
ConsoleWrite("It is well-known that Silicon is a " & AAGetItem($simple, "Silicon") & "." & @CRLF)
ConsoleWrite(@CRLF)
; A more interesting example..
$ini_path = "AA_Test.ini"
; Put this prefs section in your ini file..
; [test]
; foo=foo value
; foo2=foo2 value
; bar=bar value
; bar2=bar2 value
global $associative_array
AAInit($associative_array)
; We are going to convert this 2D array into a cute associative array where we
; can access the values by simply using their respective key names..
$test_array = IniReadSection($ini_path, "test")
for $z = 1 to 2 ; do it twice, to show that the items are *really* there!
for $i = 1 to $test_array[0][0]
$key_name = $test_array[$i][0]
ConsoleWrite("Adding '" & $key_name & "'.." & @CRLF)
; key already exists in "$associative_array", use the pre-determined value..
if AAExists($associative_array, $key_name) then
$this_value = AAGetItem($associative_array, $key_name)
ConsoleWrite("key_name ALREADY EXISTS! : =>" & $key_name & "<=" & @CRLF)
else
$this_value = $test_array[$i][1]
; store left=right value pair in AA
if $this_value then
AAAdd($associative_array, $key_name, $this_value)
endif
endif
next
next
ConsoleWrite(@CRLF & "Array Count: =>" & AACount($associative_array) & "<=" & @CRLF)
AAList($associative_array)
ConsoleWrite(@CRLF & "Removing 'foo'..")
AARemove($associative_array, "foo")
ConsoleWrite(@CRLF & "Array Count: =>" & AACount($associative_array) & "<=" & @CRLF)
AAList($associative_array)
AAWipe($associative_array)
; end
func AAInit(ByRef $dict_obj)
$dict_obj = ObjCreate("Scripting.Dictionary")
endfunc
; Adds a key and item pair to a Dictionary object..
func AAAdd(ByRef $dict_obj, $key, $val)
$dict_obj.Add($key, $val)
If @error Then return SetError(1, 1, -1)
endfunc
; Removes a key and item pair from a Dictionary object..
func AARemove(ByRef $dict_obj, $key)
$dict_obj.Remove($key)
If @error Then return SetError(1, 1, -1)
endfunc
; Returns true if a specified key exists in the associative array, false if not..
func AAExists(ByRef $dict_obj, $key)
return $dict_obj.Exists($key)
endfunc
; Returns a value for a specified key name in the associative array..
func AAGetItem(ByRef $dict_obj, $key)
return $dict_obj.Item($key)
endfunc
; Returns the total number of keys in the array..
func AACount(ByRef $dict_obj)
return $dict_obj.Count
endfunc
; List all the "Key" > "Item" pairs in the array..
func AAList(ByRef $dict_obj)
ConsoleWrite("AAList: =>" & @CRLF)
local $k = $dict_obj.Keys ; Get the keys
; local $a = $dict_obj.Items ; Get the items (for reference)
for $i = 0 to AACount($dict_obj) -1 ; Iterate the array
ConsoleWrite($k[$i] & " ==> " & AAGetItem($dict_obj, $k[$i]) & @CRLF)
next
endfunc
; Wipe the array, obviously.
func AAWipe(ByRef $dict_obj)
$dict_obj.RemoveAll()
endfunc
; Oh oh!
func AAError()
Local $err = $oMyError.number
If $err = 0 Then $err = -1
SetError($err) ; to check for after this function returns
endfunc
;; End AA Functions.

View file

@ -1,29 +0,0 @@
// arr is an array of string to int. any type can be used in both places.
var keys: domain(string);
var arr: [keys] int;
// keys can be added to a domain using +, new values will be initialized to the default value (0 for int)
keys += "foo";
keys += "bar";
keys += "baz";
// array access via [] or ()
arr["foo"] = 1;
arr["bar"] = 4;
arr("baz") = 6;
// write auto-formats domains and arrays
writeln("Keys: ", keys);
writeln("Values: ", arr);
// keys can be deleted using -
keys -= "bar";
writeln("Keys: ", keys);
writeln("Values: ", arr);
// chapel also supports array literals
var arr2 = [ "John" => 3, "Pete" => 14 ];
writeln("arr2 keys: ", arr2.domain);
writeln("arr2 values: ", arr2);

View file

@ -1,9 +1,9 @@
import system'collections;
public program()
public Program()
{
// 1. Create
var map := Dictionary.new();
auto map := Dictionary.new();
map["key"] := "foox";
map["key"] := "foo";
map["key2"]:= "foo2";

View file

@ -1,6 +1,6 @@
import system'collections;
public program()
public Program()
{
// 1. Create
auto map := new Map<string,string>();

View file

@ -1,2 +0,0 @@
(setq my-table (make-hash-table))
(puthash 'key 'value my-table)

View file

@ -1,2 +0,0 @@
(setq my-table (make-hash-table :test 'equal))
(puthash "key" 123 my-table)

View file

@ -1,7 +0,0 @@
class Main {
static public function main() {
var map = [1 => "one", 2 => "two"];
trace(map);
$type(map);
}
}

View file

@ -1,6 +0,0 @@
pprop "animals "cat 5
pprop "animals "dog 4
pprop "animals "mouse 11
print gprop "animals "cat ; 5
remprop "animals "dog
show plist "animals ; [mouse 11 cat 5]

View file

@ -1,4 +0,0 @@
$hashtable = @{
"key1" = "value 1"
key2 = 5 # if the key name has no spaces, no quotes are needed.
}

View file

@ -1,4 +0,0 @@
$hashtable.foo = "bar"
$hashtable['bar'] = 42
$hashtable."a b" = 3.14 # keys can contain spaces, property-style access needs quotation marks, then
$hashtable[5] = 8 # keys don't need to be strings

View file

@ -1,20 +0,0 @@
# Case insensitive keys, both end up as the same key:
$h=@{}
$h['a'] = 1
$h['A'] = 2
$h
Name Value
---- -----
a 2
# Case sensitive keys:
$h = New-Object -TypeName System.Collections.Hashtable
$h['a'] = 1
$h['A'] = 2
$h
Name Value
---- -----
A 2
a 1

View file

@ -1,2 +0,0 @@
$hashtable.key1 # value 1
$hashtable['key2'] # 5

View file

@ -1,4 +0,0 @@
$obj = [PSCustomObject]@{
"key1" = "value 1"
key2 = 5
}

View file

@ -1,5 +1,5 @@
-- 8 Aug 2025
include Settings
-- 23 Aug 2025
include Setting
say 'ASSOCIATIVE ARRAY: CREATION'
say version
@ -28,12 +28,10 @@ a1='x.y.z'; a.a1='periods'
a2=a1; say 'a.'a2 '=' a.a2
a1='x y z'; a.a1='spaces'
a2=a1; say 'a.'a2 '=' a.a2
a1='ÀÁÂÃÄÅ'; a.a1='special characters'
a1=''; a.a1='special characters'
a2=a1; say 'a.'a2 '=' a.a2
say
if Pos('Regina',version) > 0 then
call Library
call SysDumpVariables
call DumpVariables
exit
Capital:
@ -46,9 +44,4 @@ arg mm,dd
say mm dd 'is day no' day.mm.dd 'and week no' week.mm.dd
return
Library:
call RxFuncAdd 'SysLoadFuncs','RegUtil','SysLoadFuncs'
call SysLoadFuncs
return
include Abend
include Math

View file

@ -2,14 +2,16 @@ fn main() {
// make empty map
mut my_map := map[string]int{}
//s et value
// set value
my_map['foo'] = 3
// getting values
y1 := my_map['foo']
println(y1)
// remove keys
my_map.delete('foo')
println(my_map)
// make map with values
my_map = {
@ -17,4 +19,5 @@ fn main() {
'bar': 42
'baz': -1
}
println(my_map)
}