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

Reply via email to