|
|
Darren New <dne### [at] sanrrcom> wrote:
> You're saying "a hastable is for lookups. It doesn't have an order.
> Therefore, Python is right to base its data structures on hash tables."
It's supposed to be a hashtable. If you don't want a hashtable, you shouldn't
use it.
> Well, there ya go. So why isn't that built in, like it is in PHP, since it
> allows both random and sequential lookups? :-)
Because Python, Scheme and Haskell attempt to use the correct approaches. Form
follows function.
> So, it's OK for a mathematical set to maintain order when it's simpler,
A math set has no order. I was saying the notation of functions over set
domains employs the convention of lists of arguments because it's simpler to
notate than named arguments out of order.
> it's not logical to make the data structures in your language have the same
> simplicity? I'm not following. :-)
Sure, just use a list if you want simplicity. If you're using a hashtable,
you're stating order is not important. Say:
x from XS, y from YS:
f(x, y) = x*x+y
You could call it, ordered:
f(1,2)
or unordered:
f(y=3,x=4)
They just crammed the 2 behaviours into a single multipurpose data
structure(less) in PHP. Other languages have specialized data structures for
specific needs and that ought to be a good thing.
Post a reply to this message
|
|