CJam 0.6.6 dev / GolfScript, 15 14 12 byte
"0$p"0$~a:n;
Terima kasih kepada @ jimmy23013 untuk bermain golf 2 byte!
Istirahat akan diperbarui.
Verifikasi
Karena pengiriman melibatkan spasi putih yang signifikan, yang terbaik adalah membandingkan hexdumps.
$ xxd -g 1 mpquine
0000000: 22 60 30 24 7e 22 30 24 7e 4e 4d 3a 6e 3b "`0$~"0$~NM:n;
$
$ cjam mpquine | tee quine.gs | xxd -g 1
0000000: 22 60 30 24 7e 22 60 30 24 7e 0a "`0$~"`0$~.
$ golfscript quine.gs | xxd -g 1
0000000: 22 60 30 24 7e 22 60 30 24 7e 0a "`0$~"`0$~.
$ cjam quine.gs | xxd -g 1
0000000: 22 60 30 24 7e 22 60 30 24 7e "`0$~"`0$~
$
$ golfscript mpquine | tee quine.cjam | xxd -g 1
0000000: 22 60 30 24 7e 22 60 30 24 7e "`0$~"`0$~
$ cjam quine.cjam | xxd -g 1
0000000: 22 60 30 24 7e 22 60 30 24 7e "`0$~"`0$~
$ golfscript quine.cjam | xxd -g 1
0000000: 22 60 30 24 7e 22 60 30 24 7e 0a "`0$~"`0$~.
CJam
CJam mencetak "`0$~"0$~
dan linefeed tambahan. Cobalah online!
Program yang dihasilkan dicetak "`0$~"0$~
dengan linefeed baris tambahan di GolfScript ( Coba online! ), Tetapi tanpa linefeed di CJam ( Coba online! ).
Bagaimana metaquine bekerja
"`0$~" e# Push that string on the stack.
0$~ e# Push a copy and evaluate it:
e# ` Inspect the string, pushing "\"`0$~\"".
e# 0$ Push a copy.
e# ~ Evaluate, pushing "`0$~".
e# Both "\"`0$~\"" and "`0$~" are now on the stack.
NM e# Push "\n" and "".
:n; e# Map print over the elements of "" (none) and pop the result.
e# "\"`0$~\"", "`0$~", and "\n" are now on the stack, and the
e# characters they represent will be printed implicitly.
Cara kerja quine
"`0$~" # Push that string on the stack.
0$~ # As in CJam.
<LF> # Does nothing.
# "\"`0$~\"" and "`0$~" are now on the stack, and the characters
# they represent will be printed implicitly, plus a linefeed.
Tidak seperti GolfScript, CJam tidak mencetak linefeed Trailing secara default, jadi ini bukan quine di CJam.
GolfScript
GolfScript mencetak "`0$~"0$~
, tanpa tertinggal spasi. Cobalah online!
Program yang dihasilkan mencetak "`0$~"0$~
tanpa tertinggal spasi di CJam ( Coba online! ), Tetapi GolfScript menambahkan linefeed ( Coba online! ).
Bagaimana metaquine bekerja
"`0$~"0$~ # As in CJam.
NM # Unrecognized token. Does nothing.
:n # Store the top of the stack – "`0$~" – in the variable n. n holds
# "\n" by default. When the program finishes, the interpreter
# prints n implicitly, usually resulting in a trailing linefeed.
# By redefining n, it will print "0$~" instead.
; # Pop the string from the stack so it won't be printed twice.
Cara kerja quine
"`0$~"0$~ e# Works as in GolfScript.
Tidak seperti CJam, GolfScript akan menambahkan linefeed ke isi stack, jadi ini bukan quine di GolfScript.