News for hackers. Stuff that matters.
Re:Arc: Where are we going? by lacker on Monday October 27, 2008 @12:00AM (#344817)
Your point is that it is possible to iterate over any sort of data structure. This is true. The problem is that you have to use different sorts of iteration for different data structures.

Yes, it is possible to use macros to write code that works over both lists and other iterable things. But that isn't the most natural usage; Arc encourages you to write recursive functions using car and cdr. And if you have a lot of code using car and cdr, you have to rewrite that if you want to convert data from lists to another data type. Objects could possibly give you a polymorphic car and cdr, similar to Clojure, so you just don't have to worry about "what sort of iterable object" a function is going to work on.

As far as dynamic arrays versus lists, you can consider it "just an optimization step" as long as you can swap in a dynamic array for a list later on without changing your code. But that isn't possible in Arc because you will have to replace car/cdr with other iteration constructs. I think it's a little unfair to consider the difference between Lisp lists and dynamic arrays just a matter of optimization - there are plenty of things that you can't even play around with when random access is O(n). E.g. randomly shuffling the lines of a large text file.

There are no comments on this comment yet.