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

@ -4,24 +4,24 @@ package require Tcl 8.6
proc joinTables {tableA a tableB b} {
# Optimisation: if the first table is longer, do in reverse order
if {[llength $tableB] < [llength $tableA]} {
return [lmap pair [joinTables $tableB $b $tableA $a] {
lreverse $pair
}]
return [lmap pair [joinTables $tableB $b $tableA $a] {
lreverse $pair
}]
}
foreach value $tableA {
lappend hashmap([lindex $value $a]) [lreplace $value $a $a]
#dict version# dict lappend hashmap [lindex $value $a] [lreplace $value $a $a]
lappend hashmap([lindex $value $a]) [lreplace $value $a $a]
#dict version# dict lappend hashmap [lindex $value $a] [lreplace $value $a $a]
}
set result {}
foreach value $tableB {
set key [lindex $value $b]
if {![info exists hashmap($key)]} continue
#dict version# if {![dict exists $hashmap $key]} continue
foreach first $hashmap($key) {
#dict version# foreach first [dict get $hashmap $key]
lappend result [list {*}$first $key {*}[lreplace $value $b $b]]
}
set key [lindex $value $b]
if {![info exists hashmap($key)]} continue
#dict version# if {![dict exists $hashmap $key]} continue
foreach first $hashmap($key) {
#dict version# foreach first [dict get $hashmap $key]
lappend result [list {*}$first $key {*}[lreplace $value $b $b]]
}
}
return $result
}