Ash now has arithmetic AND, OR, and NOT. Those actually suffice; you can use them to generate the other 14 truth tables. For example, a NAND b = NOT ( a AND b). And a XOR b is (a AND NOT b) OR (b AND NOT a)
Unfortunately, XOR is a common enough operation that many computer languages offer it as an operator, along with the three I added to ASH. The "usual" operator used for it is "^".
Unfortunately, ASH already uses that operator - for exponentiation. Just like Algol 60 - an obsolete language. Other languages, obsolete or not (Fortran and Python) use **. Still others (C, Java, etc.) do not offer an operator for exponentiation. Instead, they offer functions.
I'm considering adding XOR to ASH. I see three options:
1) Don't bother. If the purported XOR operator is "^", you can get it yourself like this:
a ^ b --> (a & ~b) | (b & ~a)
a ^= b --> a = (a & ~b) | (b & ~a)
Advantages: developer sloth
Disadvantages: script writer pain
2) Change ASH such that ^ is XOR (like most modern languages) and exponentiation is ** or a function.
Advantages: Modernity
Disadvantages: not backwards compatible. Existing scripts - including zlib - would need to change. Earlier versions of said scripts could not run with current versions of KoLmafia and vice versa
3) Add XOR as ^^ and ^^=
Advantages: backwards compatibility
Disadvantages: non-standard - unique, even - operator to confuse experienced programmers in other modern languages.
Vote and comment, please. Thanks.
Unfortunately, XOR is a common enough operation that many computer languages offer it as an operator, along with the three I added to ASH. The "usual" operator used for it is "^".
Unfortunately, ASH already uses that operator - for exponentiation. Just like Algol 60 - an obsolete language. Other languages, obsolete or not (Fortran and Python) use **. Still others (C, Java, etc.) do not offer an operator for exponentiation. Instead, they offer functions.
I'm considering adding XOR to ASH. I see three options:
1) Don't bother. If the purported XOR operator is "^", you can get it yourself like this:
a ^ b --> (a & ~b) | (b & ~a)
a ^= b --> a = (a & ~b) | (b & ~a)
Advantages: developer sloth
Disadvantages: script writer pain
2) Change ASH such that ^ is XOR (like most modern languages) and exponentiation is ** or a function.
Advantages: Modernity
Disadvantages: not backwards compatible. Existing scripts - including zlib - would need to change. Earlier versions of said scripts could not run with current versions of KoLmafia and vice versa
3) Add XOR as ^^ and ^^=
Advantages: backwards compatibility
Disadvantages: non-standard - unique, even - operator to confuse experienced programmers in other modern languages.
Vote and comment, please. Thanks.