Elektrine lite

← Feed

@SmartmanApps@dotnet.social

2023-10-30 09:43 UTC

6/9 8. left-associativity - a term is associated with the sign to it's left. In 2-3, 3 is associated with a minus, and 2 is associated with a (unwritten) plus. We CAN go right to left PROVIDED we maintain that. i.e. right to left would be -3+2, not 3-2. This doesn't apply to division though - in that case we must go left-to-right - otherwise it's just an easy way to maintain left associativity...

Replies (1)

  • @SmartmanApps@dotnet.social 2023-10-30 09:45

    7/9 9. multiply and divide are binary operators - i.e. they are associated with both the terms that follow them AND precede them - whereas add and subtract are unary operators, only associated with the term that follows. This means that, since we perform operations on terms and not expressions, you MUST solve binary operators before unary operators, but within each can be done either way. e.g. doesn't matter if you do multiplication or division first, ditto for add and subtract...

    Open ##5327891