Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 42dd07842d7868dd0e025dd8120cbf301df83b9e
Ticket: 689652ffffffffffffffffffffffffffffffffff
lsearch fuller functionality
User & Date: vincentdarley on 2003-02-19 23:06:10
Changes

  1. assignee changed to: "dkf"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Recent versions of Tcl introduced the '-sorted', 
    and '-all' flags to lsearch (with associated flags '-
    ascii', '-dictionary', 'integer', etc).
    
    However, many combinations are disallowed, and 
    some of the implementation could be made more 
    efficient.
    
    For example 'lsearch -sorted -all' doesn't do a 
    binary search, claiming (in the code) "note that 
    there is no point in being smart when -all was 
    specified; in that case, we have to look at all items 
    anyway".  But that isn't true, one could do a forward 
    and a backward binary search and then return the 
    remaining range (or do a forward binary search and 
    then a forward negated binary search from that 
    point).
    
    Another problem is that one can't use any form of 
    pattern with '-sorted', which would be very useful. 
    For example these useful examples are illegal:
    
    lsearch -sorted -glob -- "aaaa aabb aabc aacc 
    abcc" "aab*"
    
    would (if the list was much longer, like a 
    dictionary) return 1, and:
    
    lsearch -sorted -glob -all -- "aaaa aabb aabc aacc 
    abcc" "aab*"
    
    would return "1 2" (and with '-inline' this would be 
    a nice way of efficiently returning just the 
    relevant 'lrange').
    
    Finally, I point out that several examples at the 
    bottom of the lsearch man page use a '-data' 
    option which is not in Tcl at all!
    
    
    
    
    
  4. foundin changed to: "None"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "vincentdarley"
  9. subsystem changed to: "17. Commands I-L"
  10. title changed to: "lsearch fuller functionality (and small doc bug)"
  11. type changed to: "RFE"