Skip to content
Tcl Source Code Artifact [42dd07842d]
Login

Artifact [42dd07842d]

Artifact 42dd07842d7868dd0e025dd8120cbf301df83b9e:

Ticket change [42dd07842d] - New ticket [689652ffffffffff|689652ffff] <i>lsearch fuller functionality (and small doc bug)</i>. by vincentdarley on 2003-02-19 23:06:10.
D 2003-02-19T23:06:10
J assignee dkf
J cmimetype text/plain
J comment Recent\sversions\sof\sTcl\sintroduced\sthe\s'-sorted',\s\nand\s'-all'\sflags\sto\slsearch\s(with\sassociated\sflags\s'-\nascii',\s'-dictionary',\s'integer',\setc).\n\nHowever,\smany\scombinations\sare\sdisallowed,\sand\s\nsome\sof\sthe\simplementation\scould\sbe\smade\smore\s\nefficient.\n\nFor\sexample\s'lsearch\s-sorted\s-all'\sdoesn't\sdo\sa\s\nbinary\ssearch,\sclaiming\s(in\sthe\scode)\s"note\sthat\s\nthere\sis\sno\spoint\sin\sbeing\ssmart\swhen\s-all\swas\s\nspecified;\sin\sthat\scase,\swe\shave\sto\slook\sat\sall\sitems\s\nanyway".\s\sBut\sthat\sisn't\strue,\sone\scould\sdo\sa\sforward\s\nand\sa\sbackward\sbinary\ssearch\sand\sthen\sreturn\sthe\s\nremaining\srange\s(or\sdo\sa\sforward\sbinary\ssearch\sand\s\nthen\sa\sforward\snegated\sbinary\ssearch\sfrom\sthat\s\npoint).\n\nAnother\sproblem\sis\sthat\sone\scan't\suse\sany\sform\sof\s\npattern\swith\s'-sorted',\swhich\swould\sbe\svery\suseful.\s\nFor\sexample\sthese\suseful\sexamples\sare\sillegal:\n\nlsearch\s-sorted\s-glob\s--\s"aaaa\saabb\saabc\saacc\s\nabcc"\s"aab*"\n\nwould\s(if\sthe\slist\swas\smuch\slonger,\slike\sa\s\ndictionary)\sreturn\s1,\sand:\n\nlsearch\s-sorted\s-glob\s-all\s--\s"aaaa\saabb\saabc\saacc\s\nabcc"\s"aab*"\n\nwould\sreturn\s"1\s2"\s(and\swith\s'-inline'\sthis\swould\sbe\s\na\snice\sway\sof\sefficiently\sreturning\sjust\sthe\s\nrelevant\s'lrange').\n\nFinally,\sI\spoint\sout\sthat\sseveral\sexamples\sat\sthe\s\nbottom\sof\sthe\slsearch\sman\spage\suse\sa\s'-data'\s\noption\swhich\sis\snot\sin\sTcl\sat\sall!\n\n\n\n
J foundin None
J priority 5\sMedium
J resolution None
J status Open
J submitter vincentdarley
J subsystem 17.\sCommands\sI-L
J title lsearch\sfuller\sfunctionality\s(and\ssmall\sdoc\sbug)
J type RFE
K 689652ffffffffffffffffffffffffffffffffff
U vincentdarley
Z 7de0939a601db2da6521e64dded5de5a