Comment by DeusExMachina
15 years ago
Does anybody care to explain the strange indentation I see in the Arc code? I know Lisp a little (mostly Clojure), but I don't get the indentation of the code at the bottom of the algorithm where it looks like it's branching in two parts. Is this peculiar to Arc? Or to other Lisps as well?
That's because of the way Arc does if-expressions. In Scheme and Common Lisp, you have two conditional forms: 'if and 'cond. 'if takes three arguments (or two, with an implied nil, in CL), and is analogous to an if-then-else in other languages:
'cond, in contrast, takes as many branches as you like, but they're parenthesized like so:
In arc, there's just 'if, which is like 'cond with a lot of implicit parenthesization and else-branches:
I've barely looked at Arc[1] but as far as I remember, the if macro/special form allows an arbitrary number of argument forms, a bit like a combination of Clojure/CL's if and cond:
With an even number of arguments, there is no else-expr (the same as CL/Clojure cond).
The indentation is probably to distinguish between condition and conditional expression - the second column is what could be evaluated and returned from the whole expression.
[1] I too use Clojure
Doesn't stray that much from clojure, so I think it's a lisp thing. To keep bindings in clojure with different length names more readable, people tend to indent like this:
Sort of the same effect in the arc snippet in OP.