On Saturday, May 7, 2022 at 6:44:06 AM UTC+2, Cecil Westerhof wrote:
To transform a dict to a list of list I use:
set swapList {}
dict for {name swap} ${swapDict} {
lappend swapList [list $name $swap]
}
But I seem to remember that there is a command that does this, but I
do not remember the command.
Am I mistaken? If not: what is the command?
Are you looking for [lmap {k v} {a b c d e f} {list $k $v}]? Note that this shimmers from dict to list:
expect:~$ set d [dict create a b c d e f]
a b c d e f
expect:~$ ::tcl::unsupported::representation $d
value is a dict with a refcount of 4, object pointer at 0xcaf7d0, internal representation 0xcf4570:(nil), string representation "a b c d e f"
expect:~$ lmap {k v} $d {list $k $v}
{a b} {c d} {e f}
expect:~$ ::tcl::unsupported::representation $d
value is a list with a refcount of 4, object pointer at 0xcaf7d0, internal representation 0xd343d0:(nil), string representation "a b c d e f"
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)