使用tcl/expect实现对链表反转

来源:互联网 发布:淘宝怎么极速退款 编辑:程序博客网 时间:2024/06/05 15:41
#!/usr/bin/env expect


# Reverse the list 
set a {1 2 3 4 5 6 7}
set aLen [llength $a]
set iLen [expr $aLen - 1]


for {set i $iLen} {$i >= 0} {incr i -1} {
    lappend b [lindex $a $i]
}


puts "b is <$b>"
原创粉丝点击