4 ms·
In TCL, zip functionality is built into the foreach loop. foreach x $list1 y $list2 { lappend result [Myfunc $x $y] } To directly return a
by bloaf 4y ago
In TCL, zip functionality is built into the foreach loop.
foreach x $list1 y $list2 {
lappend result [Myfunc $x $y]
}
To directly return a list of outputs without having to append to a list, TCL also provides lmap which works the same way:
lmap x $list1 y $list2 {Myfunc $x $y}
But wait there's more! Foreach and lmap also support taking more than one element from the list each time:
lmap {x y} $list1 {Myfunc $x $y}
- lupire 4y agoIt's gauche to flaunt the power of the gods among mortals.