CJam 0.6.6 dev / GolfScript、15 14 12バイト
"0$p"0$~a:n;
2バイトのゴルフをしてくれた@ jimmy23013に感謝します!
残りは更新されます。
検証
提出にはかなりの空白が含まれるため、hexdumpを比較するのが最善です。
$ 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印刷"`0$~"0$~
と末尾の改行。オンラインでお試しください!
生成されたプログラム"`0$~"0$~
は、GolfScriptの末尾の改行(オンラインで試してみてください!)で印刷されますが、CJamの改行なし(オンラインで試してみてください!)。
メタキンの仕組み
"`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.
クインの仕組み
"`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.
GolfScriptとは異なり、CJamはデフォルトで末尾の改行を出力しないため、これはCJamのキインではありません。
GolfScript
GolfScriptは"`0$~"0$~
、末尾の空白なしで印刷します。オンラインでお試しください!
生成されたプログラム"`0$~"0$~
は、CJamの末尾の空白なしで印刷されます(オンラインで試してください!)が、GolfScriptは改行を追加します(オンラインで試してください!)。
メタキンの仕組み
"`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.
クインの仕組み
"`0$~"0$~ e# Works as in GolfScript.
CJamとは異なり、GolfScriptはスタックのコンテンツに改行を追加するため、GolfScriptのキインではありません。