From: cche on 19 Jan 2010 06:58 Hi all, I had the following problem while using lsort $ tclsh >info pa 8.5.8 >set allelems [list [list chr12 5] [list chr04 1] [list chr08 13]] {chr12 5} {chr04 1} {chr08 13} >lsort -decreasing -index 1 $allelems {chr12 5} {chr08 13} {chr04 1} <-- !!!! >lsort -decreasing -integer -index 1 $allelems {chr08 13} {chr12 5} {chr04 1} As you can see, I solved my problems by including the -integer option, but why does lsort in its default setting consider 5 > 13 ? Cristian
From: Kevin Kenny on 19 Jan 2010 07:01 cche wrote: > As you can see, I solved my problems by including the -integer option, > but why does lsort in its default setting consider 5 > 13 ? Because its default setting is simply to sort everything as strings. "5" comes after "13" just as "E" comes after "AC". -- 73 de ke9tv/2, Kevin
From: Andreas Leitgeb on 19 Jan 2010 07:03 cche <cris.chaparro(a)gmail.com> wrote: > As you can see, I solved my problems by including the -integer option, > but why does lsort in its default setting consider 5 > 13 ? Because default is lexical ordering, and in a lexicon the word "zoo" comes after "arena", no matter that "zoo" is shorter.
From: cche on 19 Jan 2010 07:18 On Jan 19, 1:03 pm, Andreas Leitgeb <a...(a)gamma.logic.tuwien.ac.at> wrote: > cche <cris.chapa...(a)gmail.com> wrote: > > As you can see, I solved my problems by including the -integer option, > > but why does lsort in its default setting consider 5 > 13 ? > > Because default is lexical ordering, and in a lexicon the word > "zoo" comes after "arena", no matter that "zoo" is shorter. Thanks All! Somehow I had the idea that it would be sorted as integers if only integers were present. Hmmm that confirms my suspicion... tip 131 is still not implemented! maybe I should have tried expr [rmmadwim([lsort $allelems])] to see if I got what I wanted... ;-) Cheers, Cristian.
From: Arndt Roger Schneider on 19 Jan 2010 08:05 cche schrieb: >Hi all, >I had the following problem while using lsort >$ tclsh > > >>info pa >> >> >8.5.8 > > >>set allelems [list [list chr12 5] [list chr04 1] [list chr08 13]] >> >> >{chr12 5} {chr04 1} {chr08 13} > > >>lsort -decreasing -index 1 $allelems >> >> >{chr12 5} {chr08 13} {chr04 1} ><-- !!!! > > >>lsort -decreasing -integer -index 1 $allelems >> >> >{chr08 13} {chr12 5} {chr04 1} > >As you can see, I solved my problems by including the -integer option, >but why does lsort in its default setting consider 5 > 13 ? > >Cristian > > From the lsort man page: By default ASCII sorting is used with the result returned in increasing order. However, any of the following options may be specified before list to control the sorting process (unique abbreviations are accepted): -roger
|
Next
|
Last
Pages: 1 2 Prev: Tooltips for headers in TkTreectrl? Next: file stat and mode on Windows |