Thanks Roger. It was a good read

This part caught my eye:

"The question of the efficacy of the common convention in reducing the
need for parentheses will now be addressed. Any convention will reduce
the need for parentheses, but the important question is how the common
convention compares in this respect with other conventions, and in
particular with the notation used in this text."

How can this be applied to my subtraction issue? At the risk of
sounding silly, is there any reasonable way to change the equation to
read from right to left without parentheses?

Maybe this?

70 -: ({. - +/@}.) (100,10,20)

Or maybe it's more logical to think of it as

Score subtract (Penalty1,Penalty2)

where subtract is

Score ([ - +/@]) (Penalty1,Penalty2)

Either seem better than

((Score-Penalty1)-Penalty2)

Or

((Score-Penalty1)-Penalty2)

Each may have more parentheses than desired

I realize this is subjective, but I'm interested in opinions on what
notation is closest to thought in this example

On Thu, May 12, 2016 at 4:29 PM, Roger Hui <[email protected]> wrote:
> Perhaps an improved understanding of the inconsistencies of conventional
> notation would help?  Iverson, Conventions Governing Order of Evaluation
> <http://www.jsoftware.com/papers/EvalOrder.htm>, 1966.
>
> On Thu, May 12, 2016 at 1:10 PM, Joe Bogner <[email protected]> wrote:
>
>> I had a very silly bug in one of my programs today.
>>
>> I had the following expression:
>>
>> Total=: Score - Penalty1 - Penalty2
>>
>> Imagine the following:
>>
>> Score=:100
>> Penalty1=:10
>> Penalty2=:20
>> [ Total=: Score - Penalty1 - Penalty2
>> 110
>>
>> I would have expected 70 with my left to right brain, not 110
>>
>> Does anyone have tips on avoiding these bugs in the future or how to
>> context switch between associative rules (jumping between Excel and J for
>> example) ?
>>
>> Maybe I'll just train my brain to look out for double subtraction and turn
>> it into Score - (Penalty1 + Penalty2)
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to