Skip to content
Tcl Source Code View Ticket
Login

View Ticket

lsearch -index help page

Closed / Fixedac104c9ecbb4066f9694fdba421d46dce67bb7c2Created 3 years agoUpdated 2 years ago
Descriptionplain2024-03-20 08:16:03
I think the example given here (https://www.tcl.tk/man/tcl8.6/TclCmd/lsearch.htm#M26) is not the right one, because with or without the '-index' option, the result is the same. 

lsearch -index 1 -all -inline {{a abc} {b bcd} {c cde}} *bc*
> {a abc} {b bcd}
lsearch -all -inline {{a abc} {b bcd} {c cde}} *bc*
> {a abc} {b bcd}

Tested with versions: 8.6.14 and 9.0b1
Referenced by2
pooryorickwiki2024-11-08 11:19:13

Fixed in [17a6f70fc1]. Someone might want to backport the fix as well.

juliannoble2plain2024-11-12 07:04:37
I think the original example for the -stride version was wrong too.
The result is just a list - and shouldn't show as braced, as none of the earlier lsearch examples have an extra level of bracing for a list result.

  lsearch -stride 2 -index 1 -all -inline {a abc b bcd c cde} *bc*
      -> {a abc b bcd}

Updated version should just be:

  lsearch-stride 2 -index 1 -all -inline {abc abc abc bcd abc cde} *bc*
      -> abc abc abc bcd
pooryorickwiki2024-11-12 15:00:08

Fixed in [37bcceec1e]. Thanks for catching that.

jan.nijtmanswiki2024-11-12 23:19:07

Now merged to all branches, so can be closed.

Thanks!

Log in (anonymous is fine) to add a comment.