Version 3 of List Reverse -First In, Last Out!

Updated 2014-03-08 23:19:23 by PeterLewerin

RLE (2013-03-25): Simply use the lreverse command.

If you are using Tcl 8.4 or earlier, this command is a replacement for lreverse:

(Original code by WJG (25/03/13), minor corrections by PL 2014-03-09.)

proc lreverse {list} {

    set i [llength $list]  

    while {$i > 0} {
        incr i -1
        lappend tmp [lindex $list $i]
    }  
        
    return $tmp
}