Closed dumblob closed 3 years ago
I already pushed to master
branch a way to define "custom commands" for each type. So Dict
has commandPrefix = "dict"
and that means when you call any_cmd $some_dict
it will first try dict.any_cmd $some_dict
.
So now the idea is to use range
as a data stream generator and implement list.range
, dict.range
commands and so on. So the syntax would be the same (range $something | foreach { ... }
) but each type can implement it's own iteration logic.
(range $list | foreach
is working, although it was made "manually" and this behavior is going to be ported to list.range
.)
How to iterate over
dict
SimpleList
etc.?Something like
set d [dict (a 1)]; d | foreach k v { ... }
doesn't seem to work. Maybe extraction syntax could be used to create an iterator:<$d iter> | foreach k v { ... }
. I don't know. Please enlighten me :wink:.