News for hackers. Stuff that matters.
Re:Ivy – An interpreter for an APL-like language by bruce343434 on Sunday August 07, 2022 @04:56AM (#32375000)
> Adding parentheses makes things clearer in 99% of the cases

I will challenge that in saying that

    9*2+3/2^3
is clearer than the far more noisy

    (9*2)+(3/(2^3))
Precedence is something you learn in high school.

edit: fighting with the painful markdown of hn

Re:Ivy – An interpreter for an APL-like language by pasc1878 on Sunday August 07, 2022 @05:05AM (#32375033)
It is not that easy see the many threads over BODMAS/PEDMAS/BEDMAS.

If you actually do maths you never have the / or ÷ operator in writing equations it is always a horizontal line so you can't write maths in one line.

In your case I think the bracketed form is easier to read

If forced to write on one line suspect I would write as 9*2 + 3/(2^3)

Re:Ivy – An interpreter for an APL-like language by nerdponx on Sunday August 07, 2022 @07:57AM (#32375793)
And multiplication is very often written as two variables just sitting next to each other with no additional operator character in between.

   ((2*a) + (2*b)) / c
in math would be

    2a + 2b
    -------
       c
Traditional precedence rules make more sense with traditional handwritten notation.
Re:Ivy – An interpreter for an APL-like language by laumars on Sunday August 07, 2022 @05:07AM (#32375045)
I think all the points there are true:

The latter example is more noisy, you do learn precedence in high school yet the latter example is also more clear because it is the most accurate way of conveying intent.

Re:Ivy – An interpreter for an APL-like language by nerdponx on Sunday August 07, 2022 @07:57AM (#32375796)
This is the 1% of cases!