Version 1 of lreverse

Updated 2006-11-10 11:55:19 by suchenwi

lreverse list

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


Implemented in Tcl 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]