Ruby/Mathematica, 225 bytes
Here is my own very beatable polyquine (which serves as example and proof-of-concept):
s="s=%p;puts s%%s;#Print[StringReplace[s,{(f=FromCharacterCode)@{37,112}->ToString@InputForm@s,f@{37,37}->f@37}]]&@1";puts s%s;#Print[StringReplace[s,{(f=FromCharacterCode)@{37,112}->ToString@InputForm@s,f@{37,37}->f@37}]]&@1
The first part is based on this Ruby quineon this Ruby quine and is basically:
s="s=%p;puts s%%s;#MathematicaCode";puts s%s;#MathematicaCode
The string assignment is exactly the same in Mathematica. The puts s%s
is interpreted as a product of 4 symbols: puts
, the string s
, %
(the last REPL result or Out[0]
if it's the first expression you evaluate) and another s
. That's of course completely meaningless, but Mathematica doesn't care and ;
suppresses any output, so this is just processed silently. Then #
makes the rest of the line a comment for Ruby while Mathematica continues.
As for the Mathematica code, the largest part of it, is to simulate Ruby's format string processing without using any string literals. FromCharacterCode@{37,112}
is %p
and FromCharacterCode@{37,112}
is %%
. The former gets replaced with the string itself, (where InputForm
adds the quotes) the latter with a single %
. The result is Print
ed. The final catch is how to deal with that #
at the front. This is Mathematica's symbol for the first argument of a pure (anonymous) function. So what we do is we make all of that a pure function by appending &
and immediately invoke the function with argument 1
. Prepending a 1
to a function call "multiplies" the result with 1
, which Mathematica again just swallows regardless of what kind of thing is returned by the function.