GRP1 GRP2 GRP4 GRP5
using recursion
proc group_recurse { list } { if {[llength $list] > 1} { return "GRP[lindex $list 0]\n[group_recurse [lrange $list 1 end]]" } else { return "GRP[lindex $list 0]\n" } }puts [group_recurse {1 2 4 5}]
puts [group_recurse {1 2 4 5}]