Leaving aside the fact that you have at least 4 (EDIT: 5) mistakes in that code, I find it less readable than the Lisp equivalent. The brackets reinforce the structure imposed by the indentation and help me keep track of order of execution. But that's how my brain works and that's why syntax is subjective.
Well, the P in PEMDAS stands for 'brackets'. The clearest example, even though it's rather uncommon:
a := x ** y ** z
(and that's hoping the language does the OOE for exponentiation arithmetically correctly) versus
(setf a (expt x (expt y z)))
It's a bit like how Reverse Polish Notation is superior to the infix notation we torture ourselves with (x + y * z or (x + y) * z versus x y z * + or x y + z *).
But that's just associativity, not the order of evaluation? E.g. in C# expressions are evaluated strictly left to right, so if it had operator **, the order of evaluation would've been:
That's how variables are declared in BCPL, the language he designed and implemented in 1967. Keyword "LET", comma-separated list of names, "=", comma-separated list of expressions (that will be used to initialize the variables). For rare cases when one deliberately wants to leave a variable uninitialized, constant-valued expression "?" exists.
Comments
Lisp is versatile as all get-out, so you can program however you want. For example, we can roll like it's 1969:
Which actually supports the OP's original argument that even with training and getting used to, this syntax reads harder than
Leaving aside the fact that you have at least 4 (EDIT: 5) mistakes in that code, I find it less readable than the Lisp equivalent. The brackets reinforce the structure imposed by the indentation and help me keep track of order of execution. But that's how my brain works and that's why syntax is subjective.
My apologies, it should've been (if you insist on indentation)
Would you care to elaborate about brackets helping with tracking the order of execution? I'm really curious about that part.TXR Lisp, with infix via ifx macro:
Well, the P in PEMDAS stands for 'brackets'. The clearest example, even though it's rather uncommon:
(and that's hoping the language does the OOE for exponentiation arithmetically correctly) versus It's a bit like how Reverse Polish Notation is superior to the infix notation we torture ourselves with (x + y * z or (x + y) * z versus x y z * + or x y + z *).But that's just associativity, not the order of evaluation? E.g. in C# expressions are evaluated strictly left to right, so if it had operator **, the order of evaluation would've been:
And, eh, I am not really that convinced that is much less torturous thanThat's atrocious; = should never have a lower precedence than comma.
Please forward your complaints to Martin Richards @ https://www.cl.cam.ac.uk/~mr10/ for making this decision.
Also, why?
Sorry, where did Martin Richards supposedly make this decision?
That's how variables are declared in BCPL, the language he designed and implemented in 1967. Keyword "LET", comma-separated list of names, "=", comma-separated list of expressions (that will be used to initialize the variables). For rare cases when one deliberately wants to leave a variable uninitialized, constant-valued expression "?" exists.
Anyway, why is this syntax atrocious?