Tcl Source Code

View Ticket
Login
Ticket UUID: 3530003
Title: New option for "lsearch": "-boolean"
Type: RFE Created on: 2012-05-26 20:07:21
Submitter: zoltan3 Assigned to: dkf
Subsystem: 17. Commands I-L Severity: Minor
Priority: 5 Medium Last modified: 2026-11-13 11:18:44
Status: Closed Closed by: serhiy.storchaka
Resolution: Out of Date Closed on: 2026-11-13 11:18:43
Version: None
Description:
There is no equivalent option of lsearch which filters as "if {$element} {return $index}", but it would be nice.
User Comments:
dkf added on 2013-11-18 19:16:50:

That's funny; I don't recall seeing this one before. For general filtering, I'd use lamp instead (since you can continue to skip an element).


dkf added on 2013-11-19 09:38:13:

lmap! Not lamp! Stupid autocorrect…


serhiy.storchaka added on 2026-11-13 11:18:44:

Closing: lmap (TIP 405, Tcl 8.6), as dkf suggested, covers this filtering, e.g. lmap e $list {if {!$e} continue; set e}.