Syntactic Sugar
intermediateThe programs you wrote in the playground work, but they’re hard to read. Counting brackets, remembering that ["lambda", "x", body] means “function of x”, mentally parsing [a, "+", b] as addition. Your eyes do a lot of work that has nothing to do with the program’s meaning.
The fix isn’t to change the evaluator. It’s to write JavaScript functions that build the arrays for you. A function called add that returns [a, "+", b]. A function called fn that returns ["lambda", param, body]. Each one is trivial, just one line. But together they turn bracket soup into something that reads like math.
This is called syntactic sugar: a layer of convenience that makes programs sweeter to write without changing what they mean. The evaluator stays exactly the same. The arrays it receives are identical. The only thing that changes is how you construct them.