Skip to content
Tcl Source Code View Ticket
Login

View Ticket

"lsearch -sorted" or similar command would be useful

Closed / Fixed219043ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:09:50
OriginalBugID: 4098 RFE
Version: 8.3b2
SubmitDate: '2000-01-27'
LastModified: '2000-05-09'
Severity: LOW
Status: Released
Submitter: ericm
ChangedBy: ericm
OS: All
FixedDate: '2000-05-09'
FixedInVersion: 8.4a1
ClosedDate: '2000-10-25'


It would be useful to be able to specify to lsearch that the list it is searching is sorted, so that it could use a more efficient search algorithm (binary search, for example).

- eric



It is probably not enough to simply add -sorted.  In order to make this work, lsearch would need additional information about the data:  what kind of data is it (string, int, double?); is it sorted in ascending or descending order; maybe others.  Perhaps lsearch can deduce this information from the data itself.

- eric

I have the work for this mostly done, I'm just waiting for 8.4 to put it back into CVS.

- eric

-- 03/31/2000 ericm

Ensure that when multiple occurences of a particular string,
that the first one is returned (should return same index as
lsort unsorted). 
-- 04/03/2000 hobbs

Done and done.

- eric

-- 05/09/2000 ericm
welch Closed ticket [219043ffff]. [History diff]2000-10-26 08:34:05
dgp Open ticket [219043ffff]. [History diff]2001-04-05 07:53:39
dgp Closed ticket [219043ffff]. [History diff]2001-04-05 07:56:20
Log in (anonymous is fine) to add a comment.