News for hackers. Stuff that matters.
Re:Take the Arc Challenge by mdemare on Saturday February 02, 2008 @08:26PM (#108525)
Just counting the tokens in the codetree is not an acceptable measure of brevity, because it implies that adding primitives to a language always makes it more powerful as long it makes your application shorter just once.

But adding primitives has a cost too. You could just have let, or you could have a let for one value, one for more values, one for more values initialized as nil, or as 0, or as an empty string, etc.

In Ruby I write expressions like this a lot: condition ? string : "" I'd like to say: condition &&? string

This would make my applications shorter, but, I claim, less readable and no more powerful.

To measure power, it is not enough to look at succinctness - you must hold something else constant too.

Re:Take the Arc Challenge by pg on Sunday February 03, 2008 @01:46PM (#108712)
Sure. There are lots of pathological counterexamples to the length test. I took that as understood.
Re:Take the Arc Challenge by derefr on Monday February 04, 2008 @02:14AM (#108998)
Just as an aside about your Ruby example:

    (condition && string).to_s

    (string if condition).to_s
both work (though the first fails when passed false instead of nil.) I use something similar in quick-and-dirty Ruby shell scripts:

    n_to_generate = (ARGV.shift || "0").to_i