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

Reply via email to