Comment

Comment by retrac

Most well-written Lisp code has its structure indicated primarily by the indentation. Some form of offset rule is the most commonly suggested alternative Lisp syntax. It does make the tree structure more obvious:

    define                          (define (pos>? p1 p2)
      pos>? p1 p2                     (or (fx> (pos-row p1) (pos-row p2))
      or                                (and (fx= (pos-row p1) (pos-row p2))   
        fx>                                  (fx> (pos-col p1) (pos-col p2)))))
          pos-row p1
          pos-row p2
        and 
          fx=
            pos-row p1
            pos-row p2
          fx>
            pos-col p1 
            pos-col p2
The left looks a lot like a typical AST for many languages, such as C, shortly after parsing. As the article points out, it's the easy access to this tree-list structure at runtime, that can be easily handled as data by the program itself, that gets Lisp programmers so excited.
parent retrac 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton