Quineoid Triple - A(B) = C
C, 243 240 180 132 57 bytes
f(int*v){ v[4]^=1;}
f(int*v){ v[4]^=2;}
f(int*v){ v[4]^=3;}
Try it online: A B C
The input program can be passed as a char*
to the function f
, and is implicitly converted to an int*
.
-60 bytes thanks to @Neil
-48 bytes thanks to @Bubbler
-72 bytes thanks to @AZTECCO
Pyth, 5 + 5 + 5 = 15 bytes
CxCz1
CxCz2
CxCx3
Try A(B), A(C), B(A), B(C), C(A), C(B) online!
Explanation
CxCz_
Cz # convert input from base-256 to int
x _ # xor 1, 2 or 3 based on program
C # convert from int to base-256
brainfuck, 33+34+35=102 bytes
Perhaps one of a few answers that has the length of the 3 programs not equal. (*)
+␀>>,<,[<+>,]<-----[+>>.<<].,[.,]
++␀>>,<,[<+>,]<-----[+>>.<<].,[.,]
+++␀>>,<,[<+>,]<-----[+>>.<<].,[.,]
Try it online!
The ␀ (␀
) represents a null character.
Alternatives:
+␀>,>,[<<+>>,]<<-----[+>.<].,[.,]
-␀>,>,[<<->>,]<<+++++[->.<].,[.,]
(*): The only one at the time of posting. BF is the only used language that doesn't have integer literal.
Explanation:
+ Set a cell (call this cell 1) to X (depends on the current program, may be 1, 2 or 3)
<NUL> No operation
>, Read the first byte of the input (must be a "+") and store it in cell 2
>,[<<+>>,] Increment cell 1 by (-1+(the number of remaining "+" in the input until the <NUL>))
(use cell 3 as temporary storage)
<<----- Decrement cell 1 by 5
[+>.<] Print (-(that many)) (cell 2) (must be +)
. Print a NUL byte
,[.,] Copies the rest of the input to the output