From: Donal K. Fellows on
On 18 May, 11:11, iand <ianda...(a)gmail.com> wrote:
> Since this seems to be a very trivial issue and is needed very often,
> It will be really helpful if this feature is atleast added to any
> existing "list" command adding an extra option "-removebyindices" with
> all the error/exception handling. Like:
>
> cmd $list -removebyindices $indexlist
>
> Since tcl already has powerful list commands in kitty adding few more
> trivial features to already existing commands may be really helpful.
> Since i am not a programing/scripting guru , I do not know how to
> weigh the problems that are associated with adding features like this
> to the core. I wish i had this feature and more trivial such features
> to an already existing powerful tcl list-operations atleast adding/
> extending them with -{options}.

Most of our list manipulation commands don't take any operations; they
do what they do and just do that. There isn't a command to remove
items at indices (perhaps there should be, but there isn't) but as you
can see from this thread, it's pretty easy to add one if only numeric
indices are supported. Supporting non-numeric (i.e., end-relative)
indices would be better done from C, and that might actually be a
reasonable case for us to add an [lremove] command in the future.

Hmm. Ought to TIP that...

Donal.
From: Donal K. Fellows on
On 18 May, 11:25, "Donal K. Fellows"
<donal.k.fell...(a)manchester.ac.uk> wrote:
> Hmm. Ought to TIP that...

Done. See http://tip.tcl.tk/367.html for a more detailed plan. No time
schedule for it yet.

Donal.
From: Larry W. Virden on
On May 18, 2:53 am, "MartinLemburg(a)Siemens-PLM"
<martin.lemburg.siemens-...(a)gmx.net> wrote:

> P.S.: sometimes I feel like having to reinvent the wheel using tcl,
> just to provide such basic stuff for "internal" data structures. So I
> have my own library for lists, strings, ... . But I always found this
> a bit annoying, even feeling glad about this possibility to extend tcl
> that easily.
>

Note that the tcllib distribution (http://tcllib.sf.net/) is a set of
useful Tcl procs that developers have contributed. Perhaps it would be
worthwhile to add your library to tcllib. That distribution is pretty
common for people to have available in their environment.
From: tom.rmadilo on
On May 18, 5:09 am, "Donal K. Fellows"
<donal.k.fell...(a)manchester.ac.uk> wrote:
> On 18 May, 11:25, "Donal K. Fellows"
>
> <donal.k.fell...(a)manchester.ac.uk> wrote:
> > Hmm. Ought to TIP that...
>
> Done. See http://tip.tcl.tk/367.htmlfor a more detailed plan. No time
> schedule for it yet.

I guess TIPs are discussed on the Tcl core, but I would just like to
add here that it would be nice to move away from commands which
require using expand syntax {*} and use list syntax for the list of
indices. Note that a list is what is now returned from new commands
like [lsearch -subidices -index ...]. This should also make it much
easier to create byte-code for the command. I propose something
slightly different from my example above:

lremove ?-indexRanges? listVar [list 1 {3 5} 7 9 {11 13} {end-1 end}]

I also propose a helper function, exposed as a command [lranges
listVar rangesList].

It seems to me that users would more often know which list elements or
which ranges of elements they want and creating a new list requires
either a loop to add new elements, or expand, which could be expensive
for large lists as a Tcl proc.


From: MartinLemburg on
Hi Larry,

you are right, but I have to ask again my employer, to get his
allowance to publish code I've written some time ago during my work.

Another thing is, that I don't have currently the time to write a
"normal" tcl test suite and to introduce doctools tags for automatic
documentation.
It's not the time for doing it, but the time for learning how to do.

And at last - the sources of my library packages are only tcl 8.5+
compatible. Is this allowed for tcllib packages?

Best regards,

Martin Lemburg

On 18 Mai, 16:52, "Larry W. Virden" <lvir...(a)gmail.com> wrote:
> On May 18, 2:53 am, "MartinLemburg(a)Siemens-PLM"
>
> <martin.lemburg.siemens-...(a)gmx.net> wrote:
> > P.S.: sometimes I feel like having to reinvent the wheel using tcl,
> > just to provide such basic stuff for "internal" data structures. So I
> > have my own library for lists, strings, ... . But I always found this
> > a bit annoying, even feeling glad about this possibility to extend tcl
> > that easily.
>
> Note that the tcllib distribution (http://tcllib.sf.net/) is a set of
> useful Tcl procs that developers have contributed. Perhaps it would be
> worthwhile to add your library to tcllib. That distribution is pretty
> common for people to have available in their environment.