Skip to content
Tcl Source Code Artifact [e741bf8b7a]
Login

Artifact [e741bf8b7a]

Artifact e741bf8b7ae59cf278f33cee965133d6e310fdcb:

Ticket change [e741bf8b7a] - New ticket [218589ffffffffff|218589ffff] <i>lsort -dictionary does not work properly with ` character</i>. by nobody on 2000-10-26 01:02:48.
D 2000-10-26T01:02:48
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s1357\sBug\nVersion:\s8.0.3\nSubmitDate:\s'1999-03-02'\nLastModified:\s'2000-01-13'\nSeverity:\sMED\nStatus:\sReleased\nSubmitter:\spat\nChangedBy:\sericm\nOS:\sSolaris\nOSVersion:\s2.5.1\nMachine:\sOther\nFixedDate:\s'2000-01-13'\nFixedInVersion:\s8.3b2\nClosedDate:\s'2000-10-25'\n\n\nName:\sJason\sMechler\n\nReproducibleScript:\nSTART_OF_SCRIPT\n#!/home/jasonm/ashl/bin/tclsh8.0\n\nset\sinfilename\s[lindex\s$argv\s0]\nset\soutfilename\s[lindex\s$argv\s1]\n\nset\sinfilep\s[open\s$infilename\sr]\nset\sdata\s[read\s-nonewline\s$infilep]\nclose\s$infilep\n\nset\snewdata\s[lsort\s-dictionary\s[split\s$data\s\\n]]\n\nset\soutfilep\s[open\s$outfilename\sw]\nforeach\sitem\s$newdata\s{\n\s\s\s\s\s\s\s\sputs\s$outfilep\s$item\n}\nclose\s$outfilep\nEND_OF_SCRIPT\n\nSTART_OF_INPUT_DATA\n`\naddrf\nCOMMAND:\n!\nacicheckin\n>\s\n$\nd\n%\n!!\ndiagnose\ndeleterf\nacicheckout\nc\nACI\nEND_OF_INPUT_DATA\n\n\n\nObservedBehavior:\nWhen\sthe\sdata\sin\ssection\s6\sis\sused\sas\sinput\sto\sthe\sscript\sin\ssection\s6,\nthe\soutput\sis\sthe\sdata\sbelow,\swhich\sis\snot\sin\scorrect\sdictionary\sorder.\n(Not\sthe\spositioning\sof\saddrf\sand\sthe\s`\scharacter)\n\nThe\sproblem\sdoes\snot\shappen\sif\sthere\sare\sno\selements\sin\sthe\slist\sthat\sbegin\nwith\suppercase\sletters.\sI\sthink\sthe\sproblem\sis\sthat\sthere\sare\sa\sfew\sASCII\ncharacters\sbetween\sthe\suppercase\sand\slowercase\sletters.\sThis\sis\snot\staken\ninto\saccount\sin\sthe\sDictionaryCompare\sfunction.\n\n!\n!!\n$\n%\n>\s\nACI\nacicheckin\nacicheckout\nc\nCOMMAND:\n`\naddrf\nd\ndeleterf\ndiagnose\n\n\n\n\nDesiredBehavior:\nThe\salphanumeric\sportion\sof\sthe\slist\sshould\sbe\ssorted\sin\scorrect\sdictionary\norder.\sI\sdon't\sreally\scare\swhere\sthe\s`\sgoes,\sbut\sit\sshould\sdefinitely\sbe\nwith\sthe\sother\ssymbols\sinstead\sof\sin\sthe\smiddle\sof\sthe\sletters\n\n\n\n\nThis\sproblem\sstill\sexists\sin\s8.2,\sand\scan\scause\sdiffering\sresults\nwhen\syou\smove\sthe\s`\saround\s(yes\s-\sthe\soutput\sof\sthe\slsort\sdepends\non\sthe\sorder\sof\sthe\sinput\s-\svery\swrong).\s\sSee\sresults:\n\n(tkcon)\s64\s%\sset\sb\n`\saddrf\sCOMMAND:\s!\sacicheckin\s>\s{$}\sd\s%\s!!\sdiagnose\sdeleterf\sacicheckout\sc\sACI\n(tkcon)\s65\s%\slsort\s-diction\s$b\n!\s!!\s{$}\s%\s>\sACI\sacicheckin\sacicheckout\sc\sCOMMAND:\s`\saddrf\sd\sdeleterf\sdiagnose\n(tkcon)\s66\s%\slsort\s-diction\s[lrange\s$b\s1\send]\n!\s!!\s{$}\s%\s>\sACI\sacicheckin\sacicheckout\saddrf\sc\sCOMMAND:\sd\sdeleterf\sdiagnose\n(tkcon)\s67\s%\slsort\s-diction\s[concat\s[lrange\s$b\s1\send]\s[lindex\s$b\s0]]\n!\s!!\s{$}\s%\s>\sACI\s`\sacicheckin\sacicheckout\saddrf\sc\sCOMMAND:\sd\sdeleterf\sdiagnose\n\n--\s08/07/1999\shobbs\n\nMinimal\scase:\n\nAA\s`\sc\sCC\s==>\sAA\s`\sc\sCC\nAA\sc\s`\sCC\s==>\sAA\sc\sCC\s`\n\nThe\sproblem\sis\scaused\sby\sthe\smergesort\salgorithm\scombined\swith\sthe\sdictionary\scomparison\sfunction.\s\sThe\sfuncction\sbasically\srelies\son\sthe\sASCII\svalues\sof\sthe\scharacters\sin\sthe\sstrings\sto\sdetermine\sthe\ssorting\sorder.\s\sCharacters\swith\san\sASCII\svalue\s>\sZ\sand\s<\sa\scause\sproblems,\sbecause\sin\sa\sdictionary\scompare,\supper\sand\slower\scase\sare\sconsidered\sequivalent.\n\nUnfortunately,\sin\sthe\scomparison\sfunction,\sthe\supper/lower\sequivalency\slogic\sis\splaced\sAFTER\sthe\sstraight\sASCII\scomparison.\s\sIf\san\sinbetween\schar\sis\scompared\sto\sa\slowercase\sletter,\sit\swill\sbe\ssorted\sbefore\sthat\sletter;\sif\sit\sis\scompared\sto\san\suppercase\sletter,\sit\swil\sbe\ssorted\safter\sthat\sletter.\s\sThus\sthe\sdifferences\sbetween\sthe\soutputs\sfor\sthe\stwo\sinputs\sshown\s--\sthe\sinbetween\schar\sis\sbeing\scompared\sto\sa\sdifferent\schar,\sbasically,\sin\seach\scase.\n\nA\ssolution\sis\sto\sconvert\sall\salpha\schars\sto\supper\sor\slower\scase,\sand\sthen\sdo\sthe\scomparison.\s\sThis\sincurs\sa\sminor\sspeed\spenalty,\sas\swe\snow\shave\san\sextra\sconversion\sstep,\sbut\sas\sothers\shave\snoted,\sit\sdoesn't\smatter\show\sfast\sit\sis\sif\sit\sgives\syou\sthe\swrong\sanswer.\n\nI\selected\sto\sconvert\sto\slower\sinstead\sof\supper;\sthis\shas\sthe\seffect\sthat\sthe\sinbetween\scharacters\s`\s^\s\\\s_\s[\sand\s]\swill\ssort\sbefore\salpha\schars.\s\sThis\sseems\sappropriate\sbecause\smost\sother\spunctuation\soccurs\sbefore\sA\sas\swell.\n\nThis\sis\snow\sfixed\sin\s8.3b2.\n\n-\seric\n\n--\s01/13/2000\sericm\n\n
J foundin obsolete:\s8.0.3
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 57.\szlib
J title lsort\s-dictionary\sdoes\snot\swork\sproperly\swith\s`\scharacter
J type Bug
K 218589ffffffffffffffffffffffffffffffffff
U nobody
Z f0e96a7fbf10bfe59c3bd37afb52c9ec