This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

It's time to learn Scheme

Posted by: Anonymous [ip: 209.6.171.130] on April 08, 2008 05:07 AM
Certainly, they have many similarities and I yes, you could just say an array is a hash of sorts with numeric keys, but the types of operations you are bound to do on either data type, are different.

Arrays being for more queue like processing and hashes for keyed structures (not saying you don't know this). I don't find myself often changing from one to the other when refactoring. Usually the choice is clear from the get go. And again, outside of nested structures (which you'll get a runtime error), you'll get a compile time error when using strict.

And perhaps it's improved since I've last looked, but there are certainly performance benefits to take into account with having separate implementations.

But even so, most programs of any notable size are going to break off those things into modules and objects.

#

Return to It's time to learn Scheme