jq9wya
Last Updated: February 25, 2016
·
356
· dionysios

Common Mistake With Left of Right Evaluation in Q

q
kdb

Since all expressions are evaluated from right to left, rearranging the numbers can lead to different results.
Addition and multiplication are commutative, but the order with which they are called during a Q evaluation might yield some counterintuitive outputs. For example:

1 + 2 * 4     /output 9
2 * 4 + 1     /output 10