proc f l\ r {foreach n $l {f [regsub $n $l ""] $r\ $n} if ![llength $l] {puts [regsub _. $r ""]}} f {0 1 2 3 4 5} _