Re: TIP #176: Add String Index Values

From: Andreas Leitgeb (avl_at_gamma.logic.tuwien.ac.at)
Date: 03/29/04


Date: 29 Mar 2004 13:43:26 GMT

David S Cargo <escargo@skypoint.com> wrote:
>>The existing syntax is clumsy, though. It would be better to deprecate
>>"end" and use negative offsets to index from the end of the list. It
>>would make a lot of code cleaner.
> This is the way that access to lists and strings is done in Icon (and
> Unicon). Nonnegative numbers access from the start; negative numbers
> access from the end.

So, take [linsert $list $index foo]

What value of $index would cause "foo" being appended to $list ?
(currently, "end" does it, while "end-1" would insert it
just before the last element)

Do I understand correctly, that end-N generally would become -(N+1)
(for any nonnegative N) to get to the same position?



Relevant Pages

  • Re: TIP #176: Add String Index Values
    ... > useful feature which I hope to extend just slightly by allowing simple ... The existing syntax is clumsy, ... would make a lot of code cleaner. ...
    (comp.lang.tcl)
  • Re: No more access to characters in strings in PHP 6?
    ... $str[] was deprecated but is now undeprecated ... new syntax, then deprecate the new syntax and re-introduce the old ... Late static binding - no no no, that will make people assume that ...
    (comp.lang.php)
  • Re: "ifconfig -vlandev" syntax
    ... >>I agree the argument is useless. ... >>deprecate the old syntax so we may need to keep it around. ... root@genesis> ./ifconfig vlan0 -vlandev ...
    (freebsd-current)
  • Re: My Horrible Experience at The Inn Spot of Hampton Bays, NY
    ... a piece with syntax as clumsy as: "Recently I was excited to be ... invited to a friend's wedding at the Inn Spot of Hampton Bays located ...
    (rec.food.cooking)
  • Re: "ifconfig -vlandev" syntax
    ... Yar Tikhiy wrote: ... >>I agree the argument is useless. ... >>deprecate the old syntax so we may need to keep it around. ...
    (freebsd-current)