Updated 2017-05-17 21:54:36 by pooryorick

ycl string expand is a macro system that replaces substrings in a string by iteratively replacing lists nested in a substring itself with items from the list. The idea is to keep the source code readable while minimizing literal repetition.
set a {one two three}
set b {four five six}
if 1 [expand {
    [@
        foreach list [* $a $b *] {
            foreach item $list {
                lappend res $item
            }
        }
    @]
}]
set res ;# -> {one two three four five six}