In the article "The A-Z of Programming Languages: INTERCAL" Naomi Hamilton (Techworld Australia) interviews Don Woods, one of the authors of INTERCAL. More about INTERCAL.
On page 3 of the article the last question is:
Naomi: "Is there anything else you'd like to add?"
Don: "... Much of the fun of INTERCAL comes from figuring out how it can be used to do something that would be trivial in other languages. More fun is had by extending the language with weird new features and then figuring out what can be done by creative use of those features."
Apparently the authors of TriINTERCAL took the spirit of the language to heart, yet avoided adding an entirely useless operation.
TriINTERCAL differs from INTERCAL only in the width of the data types (one-spot data types are 10 trits wide and two-spot data types are 20 trits wide), and in the operators available in expressions. "AND" and "OR" are generalizations of the INTERCAL binary versions, "BUT" is new, and "Sharkfin" and "What" are two different interpretations of "XOR" (both of which are available in TriINTERCAL). "Mingle" mingles trits, rather than bits, whereas "Select" ANDs the two original numbers, then sorts all the bits in the first number corresponding to 2's in the second number to the least significant end, 0's in the second number to the most significant end, and 1's in between them.
"AND", "OR", "Mingle", and "Select" operate just like their binary counterparts if no trits with the value 2 are present.
$$
\begin{array}{cc|cc} \text{AND}\quad\qquad & \& & 0 & 1 & 2 \\
\hline
& 0 & 0 & 0 & 0 \\
& 1 & 0 & 1 & 2 \\
& 2 & 0 & 2 & 2 \\
\end{array}
$$
$$
\begin{array}{cc|cc} \text{OR}\quad\qquad\;\;\; & \lor & 0 & 1 & 2 \\
\hline
& 0 & 0 & 1 & 2 \\
& 1 & 1 & 1 & 2 \\
& 2 & 2 & 2 & 2 \\
\end{array}
$$
$$
\begin{array}{cc|cc} \text{BUT} \quad\qquad & @ & 0 & 1 & 2 \\
\hline
& 0 & 0 & 1 & 0 \\
& 1 & 1 & 1 & 1 \\
& 2 & 0 & 1 & 2 \\
\end{array}
$$
$$
\begin{array}{cc|cc} \text{SHARKFIN} & \land & 0 & 1 & 2 \\
\hline
& 0 & 0 & 1 & 2 \\
& 1 & 1 & 2 & 0 \\
& 2 & 2 & 0 & 1 \\
\end{array}
$$
$$
\begin{array}{cc|cc} \text{WHAT} \, \qquad & ? & 0 & 1 & 2 \\
\hline
& 0 & 0 & 1 & 2 \\
& 1 & 2 & 0 & 1 \\
& 2 & 1 & 2 & 0 \\
\end{array}
$$
Question: "How would one use “BUT” logic in a ternary logic computer in a practical way?"
Taking some liberty with the English language and the meaning of the TRiINTERCAL operators I'll explain it thusly:
The "AND" operator: Max(True), unless one is false.
The "OR" operator: Max(True), unless both are false.
The "BUT" operator: Find the 'middle ground' if allowed; if both sides fully agree then sway that way. Put another way: Always "1" unless one input is "0" or "2", then choose that instead; with "0" overriding "2".
The "SHARKFIN" operator: Addition (Mod 3). Put another way: Add and wrap, never exceeding two.
The "WHAT" operator: If both sides agree it's false, prefer "1" over "2"; oops, disregard that ... [But you weren't asking about what] ;)
Question: "How could such an operation be used in practice (either on single trits or multiple trytes)?"
The webpage "MuppetLabs" website describes it this way:
"In TriINTERCAL programs the whirlpool (@) denotes the unary tritwise BUT operation. You can think of the whirlpool as drawing values preferentially towards the central value 1. Alternatively, you can think of it as drawing your soul and your sanity inexorably down....".
"As for operators, ? is always subtract without borrow, and ^ is always add without carry. V is the OR operation and always returns the max of its inputs. & is the AND operation, which chooses 0 if possible but otherwise returns the max of the inputs. @ is BUT, which prefers 1, then 0, then the max of the remaining possibilities. Rather than add more special symbols forever, a numeric modifier may be placed directly before the @ to indicate the operation that prefers one of the digits not already represented. Thus in files ending in .5i, the permitted unary operators are ?, ^, &, @, 2@, 3@, and V. Use of such barbarisms as 0@ to represent & are not permitted, nor is the use of @ or ^ in files with either of the extensions .i or .2i. Why not? You just can't, that's why. Don't ask so many questions.".
[NOTE: In my opinion the Truth table provided by Esolangs (for "WHAT") is incorrect, it should be this:]
$$
\begin{array}{cc|cc} \text{WHAT} \, \qquad & ? & 0 & 1 & 2 \\
\hline
& 0 & 0 & 1 & 2 \\
& 1 & 1 & 0 & 1 \\
& 2 & 2 & 1 & 0 \\
\end{array}
$$
Please see Esoteric Programming Languages for less information.
BUT
would be useful at all, as of now I have no idea how it could be applied in a practical way. An answer that gave just one use ofBUT
would be good enough, I feel that is answerable and not overly broad. Also I don't think I was trying to elaborate on any points from my post in the comments as far as I can tell, I'd like to know where you thought that was happening. $\endgroup$