News for hackers. Stuff that matters.
Re:Hy – A Lisp-flavored Python by kazinator on Wednesday August 02, 2017 @06:46PM (#14915368)
There are advantages:

Long Lisp expressions break into multiple indented lines according to a couple of very easy rules:

   (- (/ (+ 1 3     ;; sideways tree [-] --- [/] --- [+] -- 1 3
            8 8)    ;;                   |       |       `- 8 8
         2)         ;;                   |        ` 2
      8)            ;;                    `- 8
by contrast, there is any satisfactory, canonical way to break up infix into multiple lines (with excellent support from editors like Emacs and Vim). Thus, Lisp expressions can be longer while remaining understandable. (Which is important because entire function definitions, for instance, are really one big expression.)

There is no ambiguity in Lisp expressions. The parentheses are not optional grouping punctuators, but operators denoting operator application (analogous to the parentheses in f(x, y)). You never, ever have to grapple with "what is the precedence/associativity of this?" or "I know the precedence/associativity of this, but did the person who wrote this intend it that way?"

Sufficiently long expressions are hard to read in any notation. Just like in any language, Lisp programs break down complex calculations with intermediate variables:

   (let ((bytes (+ 1 3 8 8)) ;; what is this term? Oh, bytes
         (words (/ bytes 2)) ;; why divide it by two? Ah 16 bit words
         (size (- words 8))) ;; Why subtract? Account for some header or special offset.
     ...)
> Do you just get used to this

What happens is that you have to get used to working with big, nested prefix expressions: because that's what functions are. A 200 line function in Lisp is a 200 line nested expression. You find that this it is perfectly manageable and you even like it. You get used to structuring code that way, and then that all applies to arithmetic expressions also, which are just more of the same thing. Given that you're able to cope with big functions made up of that sort of syntax, you are then not fazed by some five node arithmetic subexpression.

There are no comments on this comment yet.