News for hackers. Stuff that matters.
Re:(1..100).inject(&:+) by tel on Monday February 25, 2008 @07:04PM (#123459)
In this case, the "equivalent" code isn't a line that produces the same result, but is instead a line that illustrates the dynamic culture of the given language's evolution.

For Arc, right now, practically every line is an equivalent.

Re:(1..100).inject(&:+) by dusklight on Monday February 25, 2008 @09:48PM (#123573)
Well okay let me elaborate on my question.

pg has stated that code brevity is one of the main design goals of arc. But what is pretty obvious is that code brevity is not the only consideration. It is desirable to be able to write very short code, but it should be readable as well. If you write very short code that is difficult for other people to read, that is bad enough. If you write very short code that ends up being difficult even for yourself to read -- then we have a problem.

The above ruby code snippet is a great example of code where reducing the length not only did not reduce readability, but actually increased it. I know some people have complained about it being obfuscated on this board. But to me, and I am sure to a number of other people on this board, it was easy to understand, intuitive even.

so .. in arc, what would be a similar way to create a list of numbers from 1 to 100, and to evaluate the sum of that list?

Re:(1..100).inject(&:+) by tel on Monday February 25, 2008 @10:30PM (#123600)
That question is somewhat interesting just a little off-topic in this thread.

In Arc, that line would be:

   (reduce + (range 1 100))
which is nice, but not much different from Scheme. Pretty readable.
Re:(1..100).inject(&:+) by raganwald on Monday February 25, 2008 @07:49PM (#123486)
Thank you, exactly!!!