← Back to context

Comment by aeonik

6 hours ago

I'm starting to prefer the s expression syntax when dealing with tree structures like json.

I wonder if we were raised on tree based algebra if math would be easier to do, or harder.

Like, solve for x.

   (= (+ (* 2 x) 3) 11)
   (= (* 2 x) (- 11 3))
   (= (* 2 x) 8)
   (= x (/ 8 2))
   (= x 4)

Though this isn't too bad.

    (= (+ (pow x 2)
          (pow y 2))
       (pow r 2))

I think also a lot of my objections could be worked around if one simply had a "math" macro that evaluates infix math notation as a DSL, similarly to how the CL "loop" macro does a DSL for iteration.

Perhaps this exists already somewhere?

I definitely prefer s-exps over both xml and json myself too!

Interesting question. Much of the difficulty does stem from mentally translating back and forth between conventional notation and s-exps too, since you can’t really avoid the standard notation when reading and writing math and physics papers. And current-day math and physics notation has been optimized to some extent for the infix notation; perhaps one would have invented more expressive higher-order functions or macros to denote s-exp math if that was what everyone used for centuries.