In Common Lisp, why do multi-expression bodies of (if) statements require (progn)


Is this just a bit of historical cruft left over from the 1950s or is there some reason syntactically why multi-expression bodies of (if) forms require (progn)? Why can't you wrap the multiple expressions in a set of parentheses like with (let):

   (if some-cond
     ((exp1) (exp2) (exp3)) ; multi exp "then"
     (exp4)) ; single exp "else"

It appears it would be trivial to write a macro to test each body to see first if it is a list and then if it is, if its first element is also a list (and thus not a function invocation) and then to wrap its subcomponents inside a (progn) accordingly.

Best Solution

In Common Lisp, this code:

(if t
    ((lambda (x) (+ x 5)) 10)

will return 15. With your proposal, I think it would see that the true-clause is a list, and automatically convert it to:

(if t
    (progn (lambda (x) (+ x 5)) 10)

which would return 10. Is that right?

I'm not sure it's "trivial" to distinguish between "list" and "function invocation" in CL. Do you intend for this change to be non-backwards-compatible? (New and interesting Lisp dialects are always cool, but then it's not Common Lisp.) Or can you give an example of what you have in mind?

Related Question