Nathan makes an interesting comment on my blog.
With my Perl background, I’ve got a lot of sympathy for that position. It’s almost, but not quite, completely wrong though.
Extensible Containers are all the same and yet different
Vectors or trees or hashes or whatever, do have something in common. They are all capable of storing a bunch of things. You can have operations such as store and retrieve. That’s true of course. The difference lies in how long it takes to do an operation.
- You want to find a particular item in a singly linked list? That’ll take N/2. Insertion is constant.
- Insertion into a balanced binary tree takes log2 N. Finding an item also takes log2 N.
- Iterating over a sorted range of keys in a tree? log2 N + length of range. In a hash? N log2 N.
When I want to implement a database, or whatever, this sort of thing matters. I could always implement it on top of singly linked list, or a hash, or a vector but it would be terribly inefficient.
The English Effect
Actually the effect is not just restricted to languages, it affects all kinds of useful things. And they don’t have to be more or less powerful than other things, just different. So someone who is constrained into a scalar/array/hash view of the world, won’t necessarily see the value in binary trees2.
I think of this as The English Effect. English isn’t more or less powerful than other languages. But a native english speaker will tend to look at other languages and not see any value in learning them. They will be unaware that there are ideas that can be expressed much more elegantly in other languages.
The same ideas can be described, albeit in a clumsy way, just the same as binary trees can be implemented in assembler.
Take for example, the German doch. The number of times I have wished there was a simple disagreement with a negative assertion in English and the working efficiency it would impart is uncountable.
Oh, that idea you have, it is never going to work, the boss will never okay it and it will take to long and there are instances it won’t cover and, and, and.
You simply respond with Doch! And your negative colleague has no possible comeback. You are all able to proceed with your work and do so gladly 😉
1. I tend to find that the way it is phrased is quite condescending. And how is it a paradox anyway?
2. Looking at Nathan’s blog though, he does Lisp. And in Lisp, the basic datatype is a tree. So he’s not unfamiliar with that stuff which makes his comment even more strange to me.