Arrays, What’s the point? Good Question
Damien Katz - Damien Katz - December 25, 2008As I’m programming I haven’t seen an instance where an array is better for storing information than another form thereof. I had indeed figured the added “features” in programming languages had improved upon this and by that replaced them. I see now that they aren’t replaced but rather given new life, so to speak.
http://stackoverflow.com/questions/392397/arrays-whats-the-point
I saw this on Reddit, and the reaction wasn’t kind. Most of the discussion centered around how it was such a dumb question, and what is it that has failed in our educational or professional communities that such basic knowledge isn’t known. My initial reaction, unfortunately, wasn’t much different.
But then as I thought a little more about it, I realized it really isn’t such a dumb question. I found I really don’t use arrays in Erlang, they aren’t necessary. In C and C++, I used them all the time, you pretty much have to. But in Erlang, lists rule the day. Erlang has facilities for arrays, but the closest thing I use is small fixed-sized tuples. It’s weird, but until just now I never really noticed how little I use arrays any more. The only place I can think of ever using them in Erlang is in the CouchDB btree code for doing binary key searches.
The truth is, unless you are doing low level programming, arrays (or even vectors) are rarely necessary or even optimal for most coding problems. The most notable feature of arrays are constant time access to any value given it’s ordinal key. The problem is few programming problems call for a structure that gives them constant time access to ordinal mapped values. Most uses of arrays are just as a collection of values, and can be better satisfied with a list.
Categories: Blogs Damien Katz
Erlang on Twitter
» dfarmer (dfarmer): @pragdave My Erlang 2nd ed. B2 epub won’t parse on Google Play Books. Any way to get it regenerated? Other prag epubs work.
» WarpEngineer (agmadi): @auroberjo these people have no idea what they’re doing. If they had actually bothered to learn erlang they wouldn’t have had any problems.
» VinodShintre (Vinod Shintre): How and Why We Switched from Erlang to Python http://t.co/9jpvH6VH5Z #attribo
» MadelynGary (MadelynGary): Feel close confirmed measure time gear pertinent to erlang woof interlude http://t.co/1oqrQBl5og
» auroberjo (John Roberts): How and Why We Switched from Erlang to Python at Mixpanel Engineering http://t.co/RUWgrnjiji
» yuxhuang (Yuxing Huang): @gokeeper wish you could do apt-get install erlang?
» iS7yX (AhmeÐ): @SilenceDi I’ve learned erlang a while ago, and it really made me like FP. One day i’ll conquer Haskell though :D
» BlackBerryOS6 (BlackBerry OS 6): Présentation du langage Erlang | Blog MTI
» PieCalculus (anton): Would love to read @levwalkin and @5HT commentaries on how much these Erlang vs Python arguments are valid: http://t.co/lGO4tACvsC
» qwmp (QWMP - Chaotic): … because they do not know Erlang very well.
Statistics
Number of aggregated posts: 10648
Most recent article: May 14, 2013
Latest comments
» Moraru on This is Why You Spent All that Time Learning to Program: It is true that computer science was a pain in the back at time that i’ve had to learn it…
» Commercial hand dryers on Couchbase Meetup at new HQ: Buy online from here where you will get so much of variety in Commercial hand dryers for people. If you…
» Fort McMurray Homes on Motivated Reasoning and Erlang vs Python vs Node: I don’t really understand why this post is motivational? I don’t even see a post, just a title. Fort McMurray…