Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a5ae3076dc1eca5caf98ff68ba6e9fbfc41390892488969611d9e13d7176de19
Ticket: e68f0907ff597bfe00cd2f89d4a93ed30903cadf
data loss in `lsort -stride 2 -index 0 -command...` together with "-unique"
User & Date: oehhar on 2024-01-19 13:41:29
Changes

  1. closedate changed to: "2460329.07048389"
  2. closer changed to: "oehhar"
  3. icomment:
    Dear Andreas,
    
    thank you for the ticket. IMHO, TCL works correctly.
    
    The -unique option means, that identical comparisons following the criteria are only included once.
    
    The comparison function result is defined as follows: The script should return an integer less than, equal to, or greater than zero if the first element is to be considered less than, equal to, or greater than the second, respectively. 
    
    So, for all values where it returns 0, only one is returned.
    This means, that all keys with the same length are only returned once.
    
    To find this set, I have written a small script:
    
    <verbatim>
    set lengthlist {}
    foreach {Index Value} $mapL {
    	set length [string length $Index]
    	if {$length in $lengthlist} {continue}
    	lappend lengthlist $length
    	puts "$Index $Value"
    }
    </verbatim>
    
    The result has the same number of items, as your script:
    
    <verbatim>
    sqlite3_create_filename LiteCreateFilename
    sqlite3_column_bytes StatementColumnBytes
    sqlite3_os_init LiteOsInit
    sqlite3_sourceid LiteSourceid
    sqlite3_column_type StatementColumnType
    sqlite3_blob_open LiteBlobOpen
    sqlite3_get_clientdata LiteGetClientdata
    sqlite3_wal_checkpoint_v2 LiteWalCheckpoint
    sqlite3_extended_errcode LiteExtendedErrcode
    sqlite3_stmt_readonly StatementReadonly
    sqlite3_exec LiteExec
    sqlite3_libversion LiteLibversion
    sqlite3_bind_parameter_name StatementBindParameterName
    sqlite3_set_last_insert_rowid LiteSetLastInsertRowid
    sqlite3_bind_parameter_index StatementBindParameterIndex
    sqlite3_create_window_function LiteCreateWindowFunction
    sqlite3_reset StatementReset
    sqlite3_os_end LiteOsEnd
    sqlite3_wal_autocheckpoint LiteWalAutocheckpoint
    sqlite3_sql StatementSql
    sqlite3_rtree_geometry_callback rtree_geometry_callback
    </verbatim>
    
    The choice of the returned items is not the same, as the order of the comparison executions is not the same.
    
    Am I overlooking somethingn ?
    
    Thank you and take care,
    Harald
    
  4. login: "oehhar"
  5. mimetype: "text/x-fossil-wiki"
  6. resolution changed to: "Works For Me"
  7. status changed to: "Closed"
  8. username: "oehhar"