EuroTcl 2023 - Jim and Tcl interoperability, Featuring thing o_o, Georg Lehner, 2023-07-20

Arrays

If the value of a variable is a list with even length, then it is an array and a dict at the same time.

You can lappend to any variable.

set Var(1) a → {1 a}

dict get $Var 1 → a

lappend Var 2 → {1 a 2}

array get Var → missing value to go with key

dict get $Var 1→ missing value to go with key

array set Var {3 c} → missing value to go with key

array exists Var → 0

lappend Var b → {1 a 2 b}

array exists Var → 1

Moral: You can kill your arrays with list operations.