From: Andreas K. <a.k...@we...> - 2001-03-09 00:29:20
|
-------- > JeffH@ActiveState.com said: > > I definitely think unset x(2) should remove element two from a list > > (a shortcut for set x [lreplace $x 2 2]). It's better than lreplace > > even because it's finally an in-place operation... (of course, you'd > > still have to make a copy of the list pointers if it is a shared > > object, but this would be an improvement). > > Gee, I'm kind of with Mo on this one. I think the expectation of > a naïve user when doing [unset x(2)] will be that x(3), x(4), ... will > be left alone, rather than shifted. This is impossible semantics > for lists. > > We can use the [listx] stuff to do an in-place version of [lreplace], > to achieve the result you're after. IIRC, Andreas already has in-place > versions of all the commands. I remember that I took part in a discussion about this (own commands vs. -var option or something like that (x)), but I don't remember adding this stuff to listx ... checked back, at least nothing in the docs ... glanced at the code, nothing there. Sorry. Still, this code could be used for experimentation with list commands, yes. (x) Had no resolution between the opposing views. -- So long, Andreas Kupries <a.k...@we...> <http://www.purl.org/NET/akupries/> ------------------------------------------------------------------------------- |