Indexing ... (was: Thoughts about the controversial {expand} feature)
- From: Andreas Leitgeb <avl@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: 31 Oct 2006 07:58:58 GMT
Fredderic <put_my_name_here@xxxxxxxxxxxxxxx> wrote:
Oh, there is one point that just came to mind. There's talk of
extending the end-n notation in [lindex] and [lrange] (and others) for
general substitution and offset. It's mostly in the spirit of those
changes that I originally started arguing this thread.
I likewise appreciate the idea, and will most certainly find it very
useful, but am none the less hoping [lindex] doesn't start supporting
$a-$b*$c+$d as its index. :)
Afaik, this is limited to single "+" and "-" operations with
possibly signed arguments. e.g -5+42, 2--4, ...
There are two things I'd like to see for lrange:
1.) allow to give more ranges, that are concat'ed
[lrange {a b c d e} 0 1 3 4] -> {a b d e}
2.) allow "relative" end-indices:
[lrange {a b c d e} 2 s+1] -> {c d}
"s" being an anchor like "end", but referring to the
previously given start-index. Based on my own code,
this would not only save lots of [expr]'ing already,
but also lots of intermediate saving to vars:
set v [...]; ... [lrange $list $var [expr {$var+42}]];
PS: this subthread is no longer about tcl-syntax.
.
- References:
- Re: Thoughts about the controversial {expand} feature
- From: Donal K. Fellows
- Re: Thoughts about the controversial {expand} feature
- From: David Gravereaux
- Re: Thoughts about the controversial {expand} feature
- From: Andreas Leitgeb
- Re: Thoughts about the controversial {expand} feature
- From: Don Porter
- Re: Thoughts about the controversial {expand} feature
- From: David Gravereaux
- Re: Thoughts about the controversial {expand} feature
- From: Don Porter
- Re: Thoughts about the controversial {expand} feature
- From: David Gravereaux
- Re: Thoughts about the controversial {expand} feature
- From: Donal K. Fellows
- Re: Thoughts about the controversial {expand} feature
- From: David Gravereaux
- Re: Thoughts about the controversial {expand} feature
- From: Bruce Hartweg
- Re: Thoughts about the controversial {expand} feature
- From: David Gravereaux
- Re: Thoughts about the controversial {expand} feature
- From: TCL Warrior
- Re: Thoughts about the controversial {expand} feature
- From: Glenn Jackman
- Re: Thoughts about the controversial {expand} feature
- From: Fredderic
- Re: Thoughts about the controversial {expand} feature
- From: Andreas Leitgeb
- Re: Thoughts about the controversial {expand} feature
- From: Fredderic
- Re: Thoughts about the controversial {expand} feature
- From: Andreas Leitgeb
- Re: Thoughts about the controversial {expand} feature
- From: Fredderic
- Re: Thoughts about the controversial {expand} feature
- From: Andreas Leitgeb
- Re: Thoughts about the controversial {expand} feature
- From: Fredderic
- Re: Thoughts about the controversial {expand} feature
- From: Andreas Leitgeb
- Re: Thoughts about the controversial {expand} feature
- From: Fredderic
- Re: Thoughts about the controversial {expand} feature
- From: Fredderic
- Re: Thoughts about the controversial {expand} feature
- Prev by Date: Re: Syntax, expressiveness and the beauty of Tcl
- Next by Date: Re: examine or describe a proc?
- Previous by thread: Re: Thoughts about the controversial {expand} feature
- Next by thread: Re: Thoughts about the controversial {expand} feature
- Index(es):
Relevant Pages
|
|