From: Joe E. <jen...@fl...> - 2006-11-06 15:42:33
|
Uwe Klein wrote: > Should this support reverse ranges? > > ie. lrange $list end 0 > for inverting a list? No. There are two ways to interpret [lrange $l $a $b] when $b < $a: return the elements from $b down to $a in reverse order (like you propose), or return the empty list (what Tcl currently does). Some languages do it the first way (Python does, IIRC), and that approach comes in handy in some circumstances. And the way Tcl does it *also* comes in handy, just in different circumstances. I know I've taken advantage of the fact that [lrange $l $a $b] returns the empty list when $b < $a at times; I also doubt that I'd ever be able to find all the places I've done so. This change would replace one useful property with a different, perhaps equally useful property, but at the cost of breaking code that currently relies on the first useful property. Not worth doing. --Joe English jen...@fl... |