Comment

Comment by explainplease

You don't have to do it like that. You could do:

    (= (* x (+ y z))
       (+ (* x z) (* y z)))
Or:

    (= (* x (+ y z))
       (+ (* x z)
          (* y z)))
Or:

    (= (* x
          (+ y z))
       (+ (* x z)
          (* y z)))
Or:

    (= (+ (* x z)
          (* y z))
       (* x (+ y z)))
Or:

    (= (+ (* x z)
          (* y z))
       (* (+ y z) x))
Or:

    (= (+ (* x z)
          (* y z))
       (* (+ y z)
          x))
I think the last one makes the relationships quite clear.

Writing legible equations is an art form, as is writing sexps.

Edit: If you think lisp is ugly, compare with regexps. For bonus points, explore writing regexps with lisp, e.g. with Emacs's `rx` macro. I think you won't find a more easily maintainable way to write them.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton