loop command
This is a generic command for iterating over containers.
The varList may contain either one or two variable names. If only one is specified it iterates over the values in the containers, if two are specified the first one iterates over the keys and the second one iterates over the values.
The container may be any object which supports the container interface. An attempt will be made to convert it to a list if it does not natively support the container interface.
e.g.
% loop v [list a b c d] { puts $v } a b c d % loop {i v} [list a b c d] { puts "$i $v" } 0 a 1 b 2 c 3 d % loop v [map create {alpha a baker b}] { puts $v } a b % loop {i v} [map create {alpha a baker b}] { puts "$i $v" } alpha a baker b
accessor commands
% set a [list [vector create 1 2 3]] {<feather::vector 0x200438a8>} % getx $a 0 <feather::vector 0x200438a8> % getx $a 0 1 2
setx <container> <key1> <key2> <key3> <key4> <value> is equivalent to setx [getx <container> <key1> <key2> <key3>] <key4> <value> % set a [list [vector create 1 2 3]] {<feather::vector 0x200438a8>} % setx $a 0 99 lists are read-only % setx $a 0 1 99 % vector contents [getx $a 0] 1 99 3
count command