Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#5031 [lindex] with empty index bug

obsolete: 8.5.11
closed-invalid
Kevin B KENNY
6
2013-03-19
2012-05-10
Serg G. Brester
No

lt. documentation [lindex] could be executed with empty index.
But if additional index arguments are supplied, it fails with error "bad index".
It's not consistent for following "alternative" lines, if any of $a, $b or $c is empty:
[lindex [lindex [lindex $l $a] $b] $c] - always success
is not compatible with
[lindex $l $a $b $c] - may fails
or with
[lindex $l [list $a $b $c]] - may fails

Example:
% lindex list {}
list
% lindex [lindex list {}] 0
list
% lindex list {} 0
bad index "": must be integer?[+-]integer? or end?[+-]integer?

Discussion

    • assigned_to: sebres --> kennykb
     
  • Don Porter
    Don Porter
    2013-03-19

    [lindex] supports a single index list argument,
    or an arbitrary number of index arguments.
    It doesn't permit a mixture of the two.

     
  • Don Porter
    Don Porter
    2013-03-19

    • status: open --> closed-invalid