Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a1136cd57ee08a30816c0d55b06cbb1fd8b6551274f13a44d22ca1f6ac1fa4ea
Ticket: bc4ac0dd5f4c87677ea45fb5b480894630e3c5fb
lsearch -sorted -inline -subindices incorrect result
User & Date: juliannoble2 on 2024-11-18 16:10:19
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-plain"
  4. comment changed to:
    I've marked this as minor because the -inline -subindices result is often not particularly useful.
    
    It might be worth addressing because:
    a) -inline is a handy way to debug or try to understand/verify what is going on and the incorrect results shown below can be confusing
    b) Example 2 below is a possibly valid usecase - although somewhat contrived.
    c) The underlying cause isn't clear to me - and possibly indicative of some deeper problem
    
      ##  example 1 (of no practical use anyway)
      #correct result
      lsearch -sorted -subindices -inline -index 0 {{a 1} {a 2} {b 3} {c 4}} b
      b 
      #incorrect result with an extra list member
      lsearch -sorted -subindices -inline -index 0 {{a 1} {a 2} {b 3} {c 4} {c 5}} b
      a
    
    
      ## example 2
      #list of real values with different precision - attempt to retrieve value to see number of decimal places
      lsearch -real -sorted -inline -index 0 -subindices {{1.0 one} {2.0 two} {3.000 three} {4.00 four} {5.0 five} {6.000 six}} 1
      1.0
      lsearch -real -sorted -inline -index 0 -subindices {{1.0 one} {2.0 two} {3.000 three} {4.00 four} {5.0 five} {6.000 six}} 2
      2.0
      #surprising result
      lsearch -real -sorted -inline -index 0 -subindices {{1.0 one} {2.0 two} {3.000 three} {4.00 four} {5.0 five} {6.000 six}} 3
      2.0
      lsearch -real -sorted -inline -index 0 -subindices {{1.0 one} {2.0 two} {3.000 three} {4.00 four} {5.0 five} {6.000 six}} 4
      4.00
      #another suprising result
      lsearch -real -sorted -inline -index 0 -subindices {{1.0 one} {2.0 two} {3.000 three} {4.00 four} {5.0 five} {6.000 six}} 5
      4.00
      lsearch -real -sorted -inline -index 0 -subindices {{1.0 one} {2.0 two} {3.000 three} {4.00 four} {5.0 five} {6.000 six}} 6
      6.000
    
  5. is_private changed to: "0"
  6. login: "juliannoble2"
  7. priority changed to: "5 Medium"
  8. private_contact changed to: "957fdfcd8744611e3fe1f4896c7538b1d9bf47b2"
  9. resolution changed to: "None"
  10. severity changed to: "Minor"
  11. status changed to: "Open"
  12. submitter changed to: "juliannoble2"
  13. subsystem changed to: "17. Commands I-L"
  14. title changed to:
    lsearch -sorted -inline  -subindices incorrect result
    
  15. type changed to: "Bug"