Quine: Difference between revisions

Jump to navigation Jump to search
106 bytes added ,  10:07, 30 June 2022
no edit summary
No edit summary
Line 1: Line 1:
A '''[[wikipedia:quine|quine]]''' is a program which takes no input and produces a copy of its own source code as its only output.
A '''[[wikipedia:quine|quine]]''' is a program which takes no input and produces a copy of its own source code as its only output.
== Traditional expression ==


In APL, a quine is listed in the [[FinnAPL idiom library]] as "an expression giving itself":
In APL, a quine is listed in the [[FinnAPL idiom library]] as "an expression giving itself":
Line 5: Line 7:
       1⌽22⍴11⍴'''1⌽22⍴11⍴'''
       1⌽22⍴11⍴'''1⌽22⍴11⍴'''
</source>
</source>
=== Modern update ===


In 2019, [[Nick Nikolov]] proposed to shorten it using the [[commute]] operator:<ref>[https://chat.stackexchange.com/transcript/message/48380903#48380903 Transcript for 2019-01-06] – [[APL Orchard]].</ref>
In 2019, [[Nick Nikolov]] proposed to shorten it using the [[commute]] operator:<ref>[https://chat.stackexchange.com/transcript/message/48380903#48380903 Transcript for 2019-01-06] – [[APL Orchard]].</ref>
Line 11: Line 15:
</source>
</source>


Explanation:<ref>[https://codegolf.stackexchange.com/a/178459/87954 Golf you a quine for great good! – APL (Dyalog Unicode), 18 bytes] – Code Golf Stack Exchange.</ref>
==== Explanation ====
This shorter version is explain as follows:<ref>[https://codegolf.stackexchange.com/a/178459/87954 Golf you a quine for great good! – APL (Dyalog Unicode), 18 bytes] – Code Golf Stack Exchange.</ref>
* <source lang=apl inline>'''1⌽,⍨9⍴'''</source> the characters <source lang=text inline>'1⌽,⍨9⍴'</source>
* <source lang=apl inline>'''1⌽,⍨9⍴'''</source> the characters <source lang=text inline>'1⌽,⍨9⍴'</source>
* <source lang=apl inline>9⍴</source> reshape to shape 9, resulting in <source lang=text inline>'1⌽,⍨9⍴''</source>
* <source lang=apl inline>9⍴</source> reshape to shape 9, resulting in <source lang=text inline>'1⌽,⍨9⍴''</source>

Navigation menu