Overview
| Artifact ID: | 836587365e2d04158cfaf66a87a8cd6bfd00d7637b86dfe7cb7feee5ee3470ce |
|---|---|
| Ticket: | bc4ac0dd5f4c87677ea45fb5b480894630e3c5fb
lsearch -sorted -inline -subindices incorrect result |
| User & Date: | oehhar on 2024-11-18 16:28:32 |
Changes
- icomment:
I tried your example with TCL 8.6. The result is quite different: * the whole item is returned "b 3", not only "b" * the right one is returned So, this is a tcl 9 only bug. And also your mentioned correct ones are incorrect, as only the first sublist item is returned and not the whole sublist. tcl 8.6: <verbatim> % lsearch -sorted -subindices -inline -index 0 {{a 1} {a 2} {b 3} {c 4} {c 5}} b b 3 </verbatim> I suppose, the code was optimized to return the found item emideately but did not take into account, that this is not the total item. And I don't see this as not useful. I often use this as a lookup method like this: <verbatim> % set switch "-con" % set helplist {{-con "Show console"} {-log "Set log level"} # set help [lindex [lsearch -subindices -index 0 -inline $helplist $switch] 1] </verbatim> - login: "oehhar"
- mimetype: "text/x-fossil-wiki"
- username: "oehhar"