Data update

This commit is contained in:
Ingy döt Net 2024-10-16 18:07:41 -07:00
parent 81fd053722
commit 52a6ef48dd
10248 changed files with 63654 additions and 6775 deletions

View file

@ -1,15 +1,11 @@
Map map = text%text["Italy" => "Rome", "France" => "Paris"]
Map map ← text%text["Italy" ⇒ "Rome", "France" ⇒ "Paris"]
map.insert("Germany", "Berlin")
map["Spain"] = "Madrid"
map["Spain"] "Madrid"
writeLine("== pairs ==")
for each Pair pair in map
writeLine(pair)
end
writeLine("== keys ==")
for each text key in map.keys()
writeLine(key)
end
for each text key in map.keys() do writeLine(key) end
writeLine("== values ==")
for each text value in map.values()
writeLine(value)
end
map.values().list(<text value|writeLine(value))

View file

@ -9,4 +9,4 @@
;; loop over the assocation list:
(dolist (elem alist)
(println (format "%s -> %s" (first elem) (last elem))))
(println (format "%s -> %s" elem)))

View file

@ -0,0 +1,24 @@
(macro (ainc! Alist Key Value Function (Deflt 0))
(local (E-Message K Val Func)
(setq K Key)
(setq Func Function)
(if (true? Func)
(setq Val Value)
(begin (setq Func +) (setq Val (or Value 1))))
(unless
(catch
(setf (assoc K Alist)
(list ($it 0) (Func Val ($it 1))))
'E-Message)
(if (starts-with E-Message "ERR: no reference")
(setf Alist (cons (list K (Func Val Deflt)) Alist))
(throw-error E-Message)))))
(setq alist '())
(ainc! alist 'b 22)
(ainc! alist 'b)
(ainc! alist 'name "Fred" or)
(ainc! alist 'letters 'h cons '())
(ainc! alist 'letters 'o cons)
(println alist)

View file

@ -0,0 +1,2 @@
(dolist (e alist)
(println (format "key: %-9s val: %s" (map string e))))

View file

@ -0,0 +1,2 @@
(dolist (k (map first alist))
(println k))

View file

@ -0,0 +1,2 @@
(dolist (v (map last alist))
(println v))