|
|
Darren New <dne### [at] sanrrcom> wrote:
> nemesis wrote:
> > Darren New <dne### [at] sanrrcom> wrote:
> >> But that's kind of the point. Why do you think that? Saying "order
> >> shouldn't matter because it's a set" is begging the question.
> >
> > A set in the mathematical sense has no order.
>
> I'm asking you why a dictionary shouldn't have order. You're saying "A
> dictionary is a set, so it shouldn't have order." But what makes a
> dictionary a set?
>
> > If the guy wants order, he goes for a list.
>
> And now you're telling me how to work around the problem of sets not having
> order. See? :-)
>
> Not that it's worth arguing. I'm just pointing out the logic is flawed.
>
> > PHP only got array, so it has to play many roles.
>
> Or, I could say "Python dictionaries are broken, so you need something else
> to substitute for when you want ordered pairs."
You could say math is broken.
The primary function of a hash table is for lookup. Looking up individual
registers associated with a given key. No one said anything about order.
If you want order, append the keys to a list as they are inserted into the hash
and implement a display_hash function that will display hash items by iterating
over items from the list.
> Considering there are
> occasions when you want an order-maintaining dictionary, it would seem to be
> of benefit to have such built in.
Sure. There's also plenty of practical benefits from having a language
automatically parse numbers out of strings such as v = "24"+1, as Perl and its
bastard son PHP do.
> > Named arguments is a thing of a hip generation used to lots of cheap computing
> > power and general resources.
>
> Errrrr... math generally doesn't use named arguments, even back when
> "computer" was a job title.
All the worse as mathematicians would need to write down far too much more
symbols on paper, rather than resorting to the simpler approach of following a
given order. Lists are always simpler than sets.
Post a reply to this message
|
|