What would be the simplest/best way to encode
sign, as in +1 or -1, as a
Here’s what I can think of:
- A type with an
Intfield which I then set to either +1 or -1 when setting an instance of said type, and then multiply the value of that field with whatever I want to change the sign of.
- A type with a
Functionfield which is a function that multiplies its argument with either +1 or -1.
- Or somehow with “Value types”?
Am I over-thinking this…?