Version 2 of lreverse

Updated 2006-11-10 12:09:42 by lwv

lreverse list

Returns a list containing the elements of its argument, list, in reverse order.

Implemented in the changes in Tcl/Tk 8.5 as part of [TIP #272[L1 ].

Downward compatible pure-Tcl version:

 proc lreverse list {
    set res {}
    set i [llength $list]
    while {$i > 0} {lappend res [lindex $list [incr i -1]]}
    set res
 } ;# RS

[Category Command]