Prev: "HUH???" and/or "wiki broken, VERY broken?" was [Re: Plotting 3D surfaces]
Next: "HUH???" and/or "wiki broken, VERY broken?" was [Re: Plotting3D surfaces]
From: Donal K. Fellows on 13 Apr 2010 11:05 On 12 Apr, 17:05, "tom.rmadilo" <tom.rmad...(a)gmail.com> wrote: > In Tcl you don't sort arrays, you sort lists. Tcl Arrays do not have > an ordered representation, they just have an interface. But dictionaries can have an ordered representation (unless you're using the ones from before 8.5.0). Donal.
From: tom.rmadilo on 13 Apr 2010 11:54
On Apr 13, 8:05 am, "Donal K. Fellows" <donal.k.fell...(a)manchester.ac.uk> wrote: > On 12 Apr, 17:05, "tom.rmadilo" <tom.rmad...(a)gmail.com> wrote: > > > In Tcl you don't sort arrays, you sort lists. Tcl Arrays do not have > > an ordered representation, they just have an interface. > > But dictionaries can have an ordered representation (unless you're > using the ones from before 8.5.0). This feature doesn't help you sort, and unless you do two sorts, first on values then on keys, the end result will depend on the order of the original dictionary. With dictionaries you also could have an issue with keys that have multiple values. If multiple values are allowed per key, sorting a dictionary will be impossible, but a list of {key value} lists is covered by the same code given above. Dictionaries have the unique feature of allowing a nested key search. |