246
\$\begingroup\$

Using your language of choice, golf a quine.

A quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output.

No cheating -- that means that you can't just read the source file and print it. Also, in many languages, an empty file is also a quine: that isn't considered a legit quine either.

No error quines -- there is already a separate challenge for error quines.

Points for:

  • Smallest code (in bytes)
  • Most obfuscated/obscure solution
  • Using esoteric/obscure languages
  • Successfully using languages that are difficult to golf in

The following Stack Snippet can be used to get a quick view of the current score in each language, and thus to know which languages have existing answers and what sort of target you have to beat:

var QUESTION_ID=69;
var OVERRIDE_USER=98;

var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe";var COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk";var answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;function answersUrl(index){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}
function commentUrl(index,answers){return"https://api.stackexchange.com/2.2/answers/"+answers.join(';')+"/comments?page="+index+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}
function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(data){answers.push.apply(answers,data.items);answers_hash=[];answer_ids=[];data.items.forEach(function(a){a.comments=[];var id=+a.share_link.match(/\d+/);answer_ids.push(id);answers_hash[id]=a});if(!data.has_more)more_answers=!1;comment_page=1;getComments()}})}
function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(data){data.items.forEach(function(c){if(c.owner.user_id===OVERRIDE_USER)
answers_hash[c.post_id].comments.push(c)});if(data.has_more)getComments();else if(more_answers)getAnswers();else process()}})}
getAnswers();var SCORE_REG=(function(){var headerTag=String.raw `h\d`
var score=String.raw `\-?\d+\.?\d*`
var normalText=String.raw `[^\n<>]*`
var strikethrough=String.raw `<s>${normalText}</s>|<strike>${normalText}</strike>|<del>${normalText}</del>`
var noDigitText=String.raw `[^\n\d<>]*`
var htmlTag=String.raw `<[^\n<>]+>`
return new RegExp(String.raw `<${headerTag}>`+String.raw `\s*([^\n,]*[^\s,]),.*?`+String.raw `(${score})`+String.raw `(?=`+String.raw `${noDigitText}`+String.raw `(?:(?:${strikethrough}|${htmlTag})${noDigitText})*`+String.raw `</${headerTag}>`+String.raw `)`)})();var OVERRIDE_REG=/^Override\s*header:\s*/i;function getAuthorName(a){return a.owner.display_name}
function process(){var valid=[];answers.forEach(function(a){var body=a.body;a.comments.forEach(function(c){if(OVERRIDE_REG.test(c.body))
body='<h1>'+c.body.replace(OVERRIDE_REG,'')+'</h1>'});var match=body.match(SCORE_REG);if(match)
valid.push({user:getAuthorName(a),size:+match[2],language:match[1],link:a.share_link,})});valid.sort(function(a,b){var aB=a.size,bB=b.size;return aB-bB});var languages={};var place=1;var lastSize=null;var lastPlace=1;valid.forEach(function(a){if(a.size!=lastSize)
lastPlace=place;lastSize=a.size;++place;var answer=jQuery("#answer-template").html();answer=answer.replace("{{PLACE}}",lastPlace+".").replace("{{NAME}}",a.user).replace("{{LANGUAGE}}",a.language).replace("{{SIZE}}",a.size).replace("{{LINK}}",a.link);answer=jQuery(answer);jQuery("#answers").append(answer);var lang=a.language;lang=jQuery('<i>'+a.language+'</i>').text().toLowerCase();languages[lang]=languages[lang]||{lang:a.language,user:a.user,size:a.size,link:a.link,uniq:lang}});var langs=[];for(var lang in languages)
if(languages.hasOwnProperty(lang))
langs.push(languages[lang]);langs.sort(function(a,b){if(a.uniq>b.uniq)return 1;if(a.uniq<b.uniq)return-1;return 0});for(var i=0;i<langs.length;++i)
{var language=jQuery("#language-template").html();var lang=langs[i];language=language.replace("{{LANGUAGE}}",lang.lang).replace("{{NAME}}",lang.user).replace("{{SIZE}}",lang.size).replace("{{LINK}}",lang.link);language=jQuery(language);jQuery("#languages").append(language)}}
body{text-align:left!important}#answer-list{padding:10px;float:left}#language-list{padding:10px;float:left}table thead{font-weight:700}table td{padding:5px}
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/primary.css?v=f52df912b654"> <div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td><a href="{{LINK}}">{{SIZE}}</a></td></tr></tbody> </table> 

\$\endgroup\$
3
  • 6
    \$\begingroup\$ Do you not mean, "Golf you a quine for greater good!"? \$\endgroup\$ Commented May 3, 2011 at 2:49
  • 64
    \$\begingroup\$ @muntoo it's a play on "Learn you a Haskell for Great Good". \$\endgroup\$ Commented May 3, 2011 at 2:52
  • 28
    \$\begingroup\$ Did anybody notice that this is question 69? \$\endgroup\$
    – aidan0626
    Commented Oct 24, 2020 at 22:47

459 Answers 459

1
7 8
9
10 11
16
3
\$\begingroup\$

Gol><>, 8 7 6 bytes

"r2ssH

Hopefully this is not a previously used quine, I was messing around for another challenge having to do with quines, and I ended up creating this!

2nd program (the most recent), 7 bytes

":P}rH!

Courtesy of JoKing, who knocked an entire byte off the original!

1st program (the original), 8 bytes

":P&r&H!

I know this isn't the smallest, but it is my first quine in Gol><> (I did it entirely on my own!). Link to the interpreter in the title!

Try it online!

Code Breakdown

":P&r&H!

First, the " command collects all of the chars and rewraps around the program

Then the : command doubles the last symbol in the program, the !

Then this is incremented, and saved by the register

The stack is then reversed and the value is put back

Then the entire stack is outputted as characters and then the program halts

\$\endgroup\$
7
  • \$\begingroup\$ you can use } to rotate the stack instead of &, Try it online! \$\endgroup\$
    – Jo King
    Commented Feb 5, 2019 at 23:41
  • \$\begingroup\$ @JoKing wow, that cuts one byte off, thanks, is it okay if I put that as the answer (with credit to you of course) \$\endgroup\$ Commented Feb 5, 2019 at 23:53
  • \$\begingroup\$ of course you can. PPCG is a lot about cooperative answers rather than competition and it's nice to help new users figure out shortcuts in their chosen language(s) \$\endgroup\$
    – Jo King
    Commented Feb 5, 2019 at 23:58
  • \$\begingroup\$ @JoKing Thanks, credits are also to you! Are you a Gol><> coder, if you have any experience, do you have tips, I really like it! \$\endgroup\$ Commented Feb 6, 2019 at 0:16
  • \$\begingroup\$ there's not really much Gol><> specific advice, but I would recommend getting familiar with its parent language, ><>, first. \$\endgroup\$
    – Jo King
    Commented Feb 6, 2019 at 4:36
3
\$\begingroup\$

Attache, 69 57 53 41 bytes

Printf[s:="Printf[s:=%s,Repr@s]",Repr@s]

Try it online! Surprised I didn't think of this sooner.


Print!Format[x:="Print!Format[x:=%s,Repr!x]",Repr!x]

In the end, the standard quine framework was most efficient :( . The 57-byter below is significantly more interesting.

Try it online!

BUT I found a cooler one, also for 53 bytes!

Print!Join[q:=["Print!Join[q:=", ",Repr!q]"],Repr!q]

Try it online!

57 bytes

Print!Format<~_,Repr!_~>["Print!Format<~_,Repr!_~>[%s]"]

This uses sneaky curried functions with blanks. When a function is called using f<~...~> syntax, it denotes a curried function. _1 represents the first curried argument, _2 the second, etc. _ is an alias for _1, so this saves us some bytes without duplicating our string.

Try it online!

69 bytes

Save["Save[%c%s%c]Print[Format[_,34,_,34]]"]Print[Format[_,34,_,34]]

Try it online! The trailing newline is significant.

Explanation

Save updates the abstract variable _ with the string

"Save[%c%s%c]Print[Format[_,34,_,34]]"

Then, this string is formatted with the arguments _, 34, _, and 34. This prints the string, the character 34 (a quote), and then those two again, which is the program.

\$\endgroup\$
3
\$\begingroup\$

Fueue, 411 391 381 376 bytes

(5(2(7(1(8(0(0(4(0(2(5(2(4(9(9(0(4(9(0(2(4(2(8(2(1(6(9(0(6(2(9(5(9(5(9(0(1(1(4(0(3(2(3(1(3(1(9(1(8(1(1(1(0(1(4(0(1(2(3(1(3(1(7(1(6(1(9(0(4(9(9(5(8(2(4(9(9(0(4(9(4(9(1(6(9(0(4(9(1(0(1(6(4(9(9(5(4(9(9(0(4(9(4(9(1(6(9(0(4(9(6(2(9(5(9(0(3(1(3(1(4(9(1(1(0(2(6(1(3(1(3(1(0(2(4(2(9(0(4(9(6(2(1(6(4(9(1(6[10(:91(H49~)~48<]):[[)+$7--32+*$5--10)~[<~)~~])~!]~[~)~~])~:[)--~+40--48)~:]~]

Try it online!

See also Ørjan Johansen's answer.

Basic idea (outdated):

(7(1(9(5(1(1(8(0...                  Data.
[9!(91[+(H~)]57<33]                  Begin the second pass and end the program on second pass.
):[                                  Duplicate and evaluate the block.
    [)+$7--32+*$5--10)~[<~)~~])~!]   On the second pass, print b*10+a+32 for each two digits a, b.
    )()[~)~~]~:~<                    Copy a digit and evaluate the next line between copies.
    [)----40+--~)48~:~~]             Print "("+digit and duplicate and evaluate the whole block on the next digit.
]
\$\endgroup\$
3
\$\begingroup\$

Perl 5, 35 bytes

$_=q(print qq(\$_=q($_);eval));eval

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ Welcome! Please consider adding an explanation or a link to an online interpreter. Code-only answers tend to be automatically flagged as low-quality. \$\endgroup\$
    – mbomb007
    Commented Sep 20, 2019 at 15:42
  • 1
    \$\begingroup\$ No problem. I didn't realize that tio.run has an area to copy/paste submission markdown for code golf. Very cool. \$\endgroup\$ Commented Sep 20, 2019 at 15:45
3
\$\begingroup\$

Tir, 24 bytes

Abandoned languages are my favorite.

«⤇℘↔»
⤇℘↔

Explanation

«⤇℘↔»       Push a string onto the stack. Stack: [⤇℘↔]
      ⤇      Duplicate TOS. Stack: [⤇℘↔,⤇℘↔]
        ℘    Make top of stack in its string-represented form. Stack: [⤇℘↔,«⤇℘↔»]
         ↔   Swap top two items in the stack. Stack: [«⤇℘↔»,⤇℘↔]
Stack will be implicitly outputted.
\$\endgroup\$
3
\$\begingroup\$

Wren, 287 bytes

var a="[118,97,114,32,97,61,34].each{|m|System.write(String.fromCodePoint(m))}
System.write(a+String.fromCodePoint(34)+String.fromCodePoint(10)+a)"
[118,97,114,32,97,61,34].each{|m|System.write(String.fromCodePoint(m))}
System.write(a+String.fromCodePoint(34)+String.fromCodePoint(10)+a)

Try it online!

Explanation

var a=                                                                         // Define the variable a
      "[118,97,114,32,97,61,34].each{|m|System.write(String.fromCodePoint(m))}
System.write(a+String.fromCodePoint(34)+String.fromCodePoint(10)+a)"           // As the string that processes the variable

                                                                               // A literal newline is inserted and can be decoded literally.

[118,97,114,32,97,61,34].each{|m|System.write(String.fromCodePoint(m))}        // Output the string "var a=" to the console
System.write(                                                                  // Output without a newline:
             a                                                                 // The string a
              +String.fromCodePoint(34)                                        // Plus a quote
                                       +String.fromCodePoint(10)               // Plus a newline
                                                                +a)            // Plus the string again
```
\$\endgroup\$
3
  • 1
    \$\begingroup\$ Why doesn't fromByte work in place of fromCodePoint? \$\endgroup\$
    – Jo King
    Commented Oct 29, 2019 at 23:28
  • \$\begingroup\$ I have absolutely no idea. \$\endgroup\$
    – user85052
    Commented Oct 30, 2019 at 3:57
  • \$\begingroup\$ @JoKing It does work ;) \$\endgroup\$
    – DialFrost
    Commented Nov 8, 2022 at 1:59
3
\$\begingroup\$

Javascript, 133 bytes

a="\\";b="\"";d="throw b+'HELP!'+b+'a='+b+a+a+b+';b='+b+a+b+b+';d='+b+d+b+';'+d";throw b+'HELP!'+b+'a='+b+a+a+b+';b='+b+a+b+b+';d='+b+d+b+';'+d
\$\endgroup\$
3
\$\begingroup\$

FEU, 56 bytes

At first, I thought it was impossible.

Then I remembered __DATA__.

s/(.+)/\1\n__DATA__\n\1
__DATA__
s/(.+)/\1\n__DATA__\n\1

Try it online!

Explanation

It's just your usual quine. __DATA__ onwards is read and fed into the regex substitution, which takes the input, and puts it in this format:

input
__DATA__
input
\$\endgroup\$
3
\$\begingroup\$

!@#$%^&*()_+, 38 bytes

4K6j364K3645/1,3(!&$*)+(@)+(_+@)

Try it online!

Uses quite a few unprintables to abuse the behaviour of pushing the ordinal value of that character.

Explanation:

4K6j364K3645/1,3                           Push data section to stack   (0,data)
                                           Push zero, then the counter  (0,data,0,19)
                    (!&$*)                   Push the reverse of the data (0,data,0,atad,0)
                          +(@)               Print the data               (0,data,0)
                              +(_+@)        Print the data again, in reverse and offset by 11
\$\endgroup\$
0
3
\$\begingroup\$

Pushy, 9 bytes

95 34
_"

Although writing functional programs in Pushy is sometimes difficult, the quine is relatively simple:

95   % Push 95 to the stack (ASCII code for _ )
34   % Push 34 to the stack (ASCII code for " )
_    % Print representation of the stack: 95 34
"    % Print stack converted to string: _"

Notice that, although Pushy ignores newlines, it is needed here because the default separator for printing is \n - and there needs to be a trailing newline, hence making it 9 bytes


Alternatively, an 11-byte solution that does not require a newline:

78 95 34N_"

Works similarly to the one above, but N sets the separator an empty string.

\$\endgroup\$
0
3
\$\begingroup\$

2DFuck, 963 853 bytes

!x^x>>x>x>x>>x>>>x>x>x>x>>x>>>x>>>x>x>x>>>>x>x>x>x>>>>x>x>>x>x>x>>>x>x>x>>x>>>>x>>>x>x>x>>x>x>>x>x>>x>>x>>>>>x>>>x>>x>x>x>>x>>>x>x>x>x>>x>>>x>>>x>x>x>>>x>x>x>x>x>>>>x>x>x>>x>>>x>>>>>x>>>>x>x>x>>x>>>>x>x>x>>x>>>>x>x>x>>x>>>>x>x>x>>x>>>x>>>>>x>>>>x>x>x>x>>x>>>x>>>x>x>x>>>x>x>>x>x>x>>>x>x>x>>x>>>x>>>>>x>>>>x>x>x>>x>>>x>>>>>x>>>>x>>>x>x>x>>>x>x>x>>x>>>>x>x>>x>x>x>>x>>x>x>x>>x>>>x>x>x>>x>>>>x>x>x>>x>>>>x>x>x>>x>>>x>>>>>x>>>>x>x>x>>x>>>>x>x>x>>x>>>>x>x>x>>x>>>>x>x>x>>x>>>x>>>>>x>>>>x>x>x>>x>>>x>>>>>x>>>x>x>>x>x>>x>>>x>>>x>x>x>>x>x>>x>x>>x>>>>>x>x>x>x>>>x>x>x>x>>x>>>>x>x>x>x>>>>x>x>x>>x>>>x>>>>>x>>>>x>x>x>>x>>>>x>x>x>>x>>>>x>x>x>>x>>>>x>x>x>>x>>>x>>>>>x>>>>x>x>x>>x>>>x>>>>>x>>>>x>x>x>>x>>>>x>x>x>>x>>>x>>x>x>x>>x>>>>>x>x>x>x>>x>>>>>x>>>>x>>>x>x>x>>>>x>x>x>x>>>x>x>>x>x>>x>>>x>x>>x>x>x>v[<r!x]..!.!....!.<^x[r[!.!....!...]v.r!.!.vr^!....!.>r^]![r.v<r^]

Try it online!

Just a plain binary encoding beats out the huffman style encoding.

Explanation

!x^           Leave a marker at the start of the data string
x>>x>x>...    Push a binary string where 'x>' is 1 and '>' is 0
v[<r!x]       Move to the start of the data string
..!.!....!.   Print the leading '!'
<^x           Add a leading 1 bit to the data string
[             Loop over the data string
  r[!.!....!...]     If the current bit is a 1, print 'x'
  v.r!.!.vr^!....!.  Print a '^' if the current bit is the first bit, else '>'
  >r^                Move to the next bit
]
![            Loop over the data string in reverse
  r.v<r^        Print each bit of the data string
]

And my previous longer but more interesting answer below:

2DFuck, 963 bytes

!xv>x>x>>>x>x>>x>x>x>>x>x>>>>>x>>>x>>x>x>>>x>x>>>x>x>>>>x>x>x>>>x>x>>>x>>>>>x>>x>x>x>>x>x>x>>>x>>>x>>>x>x>x>x>>>x>>x>>x>x>x>x>x>>>x>x>>x>x>x>>>x>>>>>x>x>x>>x>x>x>>>x>>>x>>>x>x>>>x>>>x>>>x>x>x>x>>x>x>>>x>x>>x>x>x>>>x>>>>>x>x>x>>x>x>x>>>x>>>x>>x>x>x>>x>x>x>>x>>x>>>x>x>>>x>>>x>>>x>x>x>x>>x>x>>>>x>x>x>x>x>>>x>>>>>x>x>x>>x>>x>x>x>x>x>>>x>>>x>>x>x>x>>>x>>>>>x>x>x>>>x>>>x>>>x>x>>>x>>>x>>>x>x>x>x>>x>x>>>x>x>x>x>>>x>>>>>x>x>x>>x>>x>>x>x>x>x>x>>>x>>>x>x>x>>x>x>x>>x>x>x>>x>>>x>x>>>>>>>>x>>>x>x>>x>x>x>>>x>x>x>x>>x>x>>>>>x>>>>>x>x>x>>x>>x>>x>>x>>x>x>x>>x>>x>x>x>>>>x>>x>>x>x>x>>x>>x>>x>>x>x>x>>x>x>x>>x>>>x>x>>>>>>>>x>>>x>x>x>x>>>x>x>x>x>>>x>>>x>>>x>x>>x>x>x>>x>>x>x>x>>x>x>x>>x>>x>>x>x>x>>x>>x>>x>>x>x>x>>x>>x>>x>>x>x>x>>x>x>x>>x>x>x>>x>>x>>x>>x>x>x>>x>x>x>>x>>x>x>x>x>>>>>x>x>>>^x!..!.!....!.!.!....!....!...!.!..!.![<r!]![vr[!.!....!...]..!.....!.>^r!].![vr[!.!.!.<r!...!.>r!]r![<r[<r.>r..<r!..!.>r!.]r![<r[.!.!..<r.!.>r.!]r![<r[<r.!.>r.!]!...r![<r.!..>r].]]]<<^r.!]

Try it online!

I'm glad I got this below 1000 bytes. I think it still could be shorter though, maybe through encoding multiple or partial characters rather than one character per binary string. In particular encoding .. and/or !. as tokens but while that may make the data string shorter, the increases to the decoder may not be worth it. Here's the helper program to generate the program.

Explanation

!xv                Leave a marker at the start of the data string
>x>x>>>x>...       Create the binary data string where 'x>' is 1 and '>' is 0
                   Here we encode the characters of the program as
     '.' => 10
     '!' => 11
     '<' => 010
     'r' => 011
     '[' => 0010
     ']' => 0011
     '>' => 00010
     '^' => 00011
     'v' => 00000
     'x' => 00001

^x                 Leave a marker at the end of the data string
!..!.!....!.       Print '!xv'
!.!....!...
.!...!.!..!.

![<r!]             Move to the start of the data string
![                 Loop over each bit of the data string
  vr[!.!....!...]    Print an 'x' if the bit is 1
  ..!.....!.         Print a '>'
>^r!]

.!                 Print a zero bit for use in the first character
[                  Loop over the data string in reverse
  vr[                If the current bit is a 1, print 
    !.!.!.<r!...!.>r!  '.' if the next bit is a 0, otherwise '!'
  ]
  r![                Otherwise
    <r[                If the next bit is a 1, print
      <r.>r..<r!..!.>r!. '<' if the next bit is a 0, otherwise 'r'
    ]
    r![                Otherwise
      <r[                If the next bit is a 1, print
        .!.!..<r.!.>r.!    '[' if the next bit is a 0, otherwise ']'
      ]
      r![                Otherwise
        <r[<r.!.>r.!]!...  Print '>','^','v' or 'x' based on the next two bits
        r![<r.!..>r].
      ]
    ]
  ]
  <<^r            Move to the next bit in the data string
  .!              And print a zero bit for the next character
]
\$\endgroup\$
3
\$\begingroup\$

2sable, 10 bytes

44186D15B

Try it online!

This uses the same strategy as its parent language 05AB1E, but beats it by not having to join afterwards.

Explanation

44186      Push 44186
     D     Duplicate
      15B  Convert to base 15
           Implicitly print the stack
\$\endgroup\$
3
\$\begingroup\$

R, 44 41 bytes

crossed out 44 is still regular 44 ;(

-3 bytes thanks to Dominic van Essen

Works on R Version 3.6.2 and greater (thanks to Giuseppe for figuring out the versions).

`+` <-
function(x)cat(dump("+",""),1)
+ 1

Try it online!

This is 3 6 bytes shorter than the previous shortest quine by JAD.

Note that TIO currently uses R version 3.5.2, and thus adds some spaces and newlines to the output, but my local install of R version 3.6.3 does not, and gives the exact correct output.

\$\endgroup\$
15
  • 1
    \$\begingroup\$ IIRC TIO calls R by using Rscript as seen here, not sure if that's the difference. \$\endgroup\$
    – Giuseppe
    Commented Aug 4, 2020 at 15:48
  • \$\begingroup\$ Nice! And you can even shed 2 more bytes to 42 bytes (also works on R installation but not properly on TIO or RScript). \$\endgroup\$ Commented Aug 4, 2020 at 17:51
  • \$\begingroup\$ @DominicvanEssen Neat, thanks! \$\endgroup\$ Commented Aug 4, 2020 at 21:46
  • \$\begingroup\$ Some digging in R news shows that since TIO's R install (3.5.2), there's been a change to dump as of version 3.6.2: see this edition of R News. I have 3.6.1 on my machine and it prints the function() and its body on separate lines. \$\endgroup\$
    – Giuseppe
    Commented Aug 4, 2020 at 22:03
  • \$\begingroup\$ @Giuseppe Thanks for working that out! \$\endgroup\$ Commented Aug 5, 2020 at 5:39
3
\$\begingroup\$

Perl 5, 24 bytes

print<<""x2
print<<""x2

24 bytes without any options.

Try it online!

\$\endgroup\$
3
\$\begingroup\$

05AB1E, 13 bytes

"34çì«"34çì«

Try it online!

"..."34çì«  # trimmed program
"..."       # push literal...
        ì   # prepended with...
       ç    # character with codepoint...
     34     # literal...
         «  # concatenated with...
            # (implicit) itself
            # implicit output
\$\endgroup\$
3
\$\begingroup\$

Vyxal, 10 8 bytes

`:qp`:qp

Try it Online!

-2 thanks to a stone arachnid

Explained

`:qp`:qp
`:qp`    # the string ":qp"
     :q  # surrounded in backticks
       p # and prepended to itself
\$\endgroup\$
3
  • 2
    \$\begingroup\$ 8 bytes: Try it Online! \$\endgroup\$ Commented May 26, 2021 at 3:43
  • \$\begingroup\$ Does this count? \$\endgroup\$
    – user
    Commented May 30, 2021 at 16:13
  • 1
    \$\begingroup\$ @user no, it doesn't \$\endgroup\$
    – lyxal
    Commented May 30, 2021 at 22:30
3
\$\begingroup\$

Unix Executable, 10 bytes

#!/bin/cat

When run with something such as ./file, it will actually call /bin/cat ./file (because of the shebang), which prints the file's contents.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ This is not a proper quine, meaning it prints its own source code. Good try, though. With bash, I'd omit the sha-bang statement and jump straight to the cat. This would do: cat $0. In bash, sha-bang can be suppressed, and the script is treated as generic system commands. But this does not qualify as well. (I don't know if this works on other shells.) \$\endgroup\$ Commented Jul 31, 2021 at 4:40
3
\$\begingroup\$

Nim, 87 bytes

import strutils;let s="import strutils;let s=$1$2$1;echo s%[$$'$1',s]";echo s%[$'"',s]

Try it online!

\$\endgroup\$
3
\$\begingroup\$

Pxem (esolang-box notation), 21 bytes.

I originally posted this as a cheating quine, which I noticed it disqualified for the problem.

.fak.-.f.p
.fak.-.f.p

Try it online!

How it works

In this notation,

  • 1st line is main routine.
  • .f is for push its own content from 2nd to final lines.

ak.- is an idiom to push LF; .p pops each item to print them.

\$\endgroup\$
3
\$\begingroup\$

Alumin, 350 bytes

hhhhhhhhhhhhh hhhh hhhhhhhhhhhhhhhhh hhhhhhhh hhhhhhhhhhhh hhhh hhhhhhhhhhhhhhhhhhhh hhhhhhhh h hhhh hhhhhhhhhhhhhhhhhhhh hhhhhhhhhhhh h hhhhhhhhhhhhhhh hhh hhhhhhhhhhhhhhhh hhhhhhhhhhhh h hhhh h hhhh hhhhhhhhhhhhhhhhhhhh hhhh h hhhh hhhhhhhhhhhhhhh hhhh hhhh h h h hhhhhhhhhhhhh hhhhhh hhhhhhhhhhhhhhh hhhhhh h mdqhldthadtlaocpladadtdadoddaaamfof97

Try it online!

Alumin is a stack-based language that only executes the lowercase alphabetical characters.

Explanation:

hhh...     Each series of `h`s represents a single alphabetical character. h=a, hh=b, hhh=c etc.

m          Map each element to
 d         Duplicate the element as a loop counter
 q         While that element is positive
  h        Push 1
  l        Push length of stack (3)
  dt       Square (3*3=9)
  ha       Add 1 (9+1=10)
  dt       Square (10*10=100)
  la       Add length of stack (100+4=104)
  o        And output ('h')
  c        And subtract the first 1 from the counter
 p         End loop
 la        Add length to the end result (0+2=2)
 da        Double (2+2=4)
 dt        Square (4*4=16)
 da        Double (16+16=32)
 do        Dupe and output (32)
 ddaa      Triple (32+32+32=96)
 a         And add to the original value to get the ascii character
m
fof        And print each value
97         The program prints the last remaining value automatically
\$\endgroup\$
3
\$\begingroup\$

Pari/GP, 28 bytes

(()->print1("("self")()"))()

Try it online!

\$\endgroup\$
3
\$\begingroup\$

Zsh, 40 bytes

s='s=\47%s\47;printf $s $s';printf $s $s

Try it online!

Until recently, this was the shortest universally trivially modifiable quine. Uses no external commands (printf is a builtin).

(Lesson learnt: don't describe your answer as the shortest possible.)

\$\endgroup\$
3
\$\begingroup\$

Joy, 32 bytes

[put "x." putchars 10 putch] x.

Try it online!

Joy is a stack-based language. It has an interesting operation, x, which means executing a block without popping it. So [P] x is equivalent to [P] P. This is useful for writing quines.

\$\endgroup\$
4
  • \$\begingroup\$ The second time I've seen Joy, after the appearance in your article about Esolangs. \$\endgroup\$ Commented Apr 15, 2022 at 5:23
  • 1
    \$\begingroup\$ Let's see some DipDup answers too! \$\endgroup\$ Commented Apr 15, 2022 at 5:26
  • \$\begingroup\$ As a sidenote, are you still in the CGoL community? \$\endgroup\$ Commented Apr 15, 2022 at 5:27
  • 1
    \$\begingroup\$ @null I'm not active in the forum, just occasionally search the word "rlifesrc" to see if anyone has found a bug. \$\endgroup\$
    – alephalpha
    Commented Apr 15, 2022 at 5:44
3
\$\begingroup\$

Pyxplot 0.8.4, 62 bytes

q="'";Q='"';s='pr"q=",Q,q,Q,";Q=",q,Q,q,";s=",q,s,q,";@s"';@s

This quine makes use of the macro expansion operator @ to execute the code stored in the string s. Both quote characters have to be extracted to variables because there is no way to get one without the other (not counting backslash escapes, which don't help here).

Fun fact: replace pr with print and @s with eval s and you have a not-so-golfy Ruby quine.

\$\endgroup\$
3
\$\begingroup\$

Fig, \$14\log_{256}(96)\approx\$ 11.524 bytes

"
h+C34"
h+C34

Try it online!

\$\endgroup\$
0
3
\$\begingroup\$

pl – Perl One-Liner Magic Wand, 22 bytes

Very late to the party, just for fun. This decades old Perl wrapper, was only released into the wild when Corona went viral.

The 3rd quine in the blog is the actual golf. Of interest here is the 2nd 1-letter alias variant. It's essentially the same as the Perl one, which it beats by 6 bytes. As on many examples on that page, hover the ▶ button, or the blue code box, to see the result.

&f(qw(&f(qw(%s)x2))x2)
\$\endgroup\$
4
  • \$\begingroup\$ Welcome to the site and nice first answer! The "default" online interpreter we use on this site, Try It Online!, has pl listed, so I've edited your answer slightly so it's closer to our standard format. Please, feel free to check out our main questions page for more challenges you can attempt! \$\endgroup\$ Commented Oct 15, 2020 at 21:00
  • \$\begingroup\$ @caird-coinheringaahing Thanks, but that's a different pl. It implements some weird undocumented highly specialized language. It has nothing to do with Perl, other than being implemented in it. It's a total coincidence that it spews out my quine ;-) \$\endgroup\$
    – Daniel
    Commented Oct 15, 2020 at 21:09
  • \$\begingroup\$ Huh, a very weird coincidence. My mistake, I've rolled back my edit \$\endgroup\$ Commented Oct 15, 2020 at 21:10
  • \$\begingroup\$ @caird-coinheringaahing Actually not such a weird coincidence. Apart from the few (code golf only?) tasks that other pl language is capable of performing, everything you throw at it seems to be a quine. Like calling cat a language. \$\endgroup\$
    – Daniel
    Commented Oct 16, 2020 at 21:49
3
\$\begingroup\$

Functional(), 904 880 846 768 716 692 684 662 605 602 bytes

),$,$$,($(8,( $(($(<,$(,,,)),($(4,$(9,,)),($(9,$(,,0,,)),($(0,$()),$ 4)(((0,9,,$)(((,)(( $(($($$,( 9((()(9($ <($ 4(8(, 4))))))$$),, $))(( $(,(,$),,(),, 9,, 0,, $,, 4,,(,())))))),(()($$())(8(9(9(8(4(4(8(9(8(8(<(9(9(9(9(9(9(9(8(<(8(<(<(4($,0(<(<(4(0(<(<(0($,0(<(<(9($,0(<(<(9(8(<(<(9(4(<(8(<(8(4(0(8(8(9(9(4(0(<(<(9(4(4(9(9(9(9(9(9(4($,0(<(8(8($,8(4($,0(4(8(<($,0(4(8(9($,8(9(8(8(8(9($,0(8(<(4(4(8(4(8(8(4(0(8(8(9(<(8(8(8(9(4(<(<(9($,<(0($,8(8(8(9(4($,0(4(<(9(9(8(4(<(0($,8(4(8(<(9(9(<(<(0($,<(<(8(4(<(9($,8(4(8(<(9(9(<(<(9($,8(4(<(4($,8(4(8(<(9(9(<(<(<(8(4(<(<($,8(4(8(8(4(0(8(<(8($,8(4(8(<(4(4(<(4(<(9(

Try it online!
Try the 605B version online!
Try the 662B version online!
Try the 684B version online!
Try the 692B version online!
Try the 716B version online!
Try the 768B version online!
Try the 846B version online!
Try the 880B version online!
Try the 904B version online!

This code comes from a generator code below;

),1,P,
:(h,
  & 1(
    :(l,1(>,>)),
    :(d,1(i,>)),
    :(i,1(>,`,>)),
    :(`,1()),
    1 d
  )(
    &(`,i,X)(
      &(>)(
        & 1(
          :(P,
            & i(
              &()(
                i(1 l(1 d(h(> d))))
              )
            )P
          ),
          > 1
        )
      )(
        & 1(
          >(X),>(),> i,> `,> 1,> d,>(>())
        )
      )
    )
  )
),
&()(
  P()
)(

h(i(
  i(h(d(d(
h(i(h(h(
l(i(
  i(
    i(
      i(
        i(
          i(i(h(l(h(l(l(d(1,`(l(l(d(`(l(l(`(1,`(l(l(i(1,`(l(l(i(h(l(l(i(d(l(h(l(
        h(d(`(h(
      h(i(
        i(
          d(`(l(
          l(i(
            d(d(i(
              i(
                i(i(i(i(d(1,`(l(h(h(1,h(d(1,`(d(h(l(1,`(d(h(i(1,
              h(i(h(h(
            h(i(1,`(h(
          l(d(d(h(d(h(
        h(d(`(h(
      h(i(l(h(h(
    h(i(d(l(l(i(1,l(`(1,h(h(
  h(i(
    d(1,`(d(
    l(i(i(h(d(l(`(1,h(d(h(
    l(i(i(l(l(`(1,l(l(h(d(l(i(1,h(d(h(
    l(i(i(l(l(i(1,h(d(l(d(1,h(d(h(
    l(i(i(l(l(l(h(d(l(l(1,h(d(h(
  h(d(`(h(
l(h(1,h(d(h(
l(d(d(l(d(l(i(

Try the generator code online! ( Try the encoder script online!)
Try the 605B generator code online!
Try the 662B generator code online! ( Try the 662B encoder script online! )
Try the 684B generator code online!
Try the 692B generator code online!
Try the 716B generator code online!
Try the 768B generator code online! ( Try the 768B encoder script online! )
Try the 846B generator code online!
Try the 880B generator code online!
Try the 904B generator code online!

The core part of the code is encoded with `,d,h,i,l for space,1,(,),comma respectively. Other characters &,>,:,P,X are treated as (,comma,(1,11,,1

The actual characters in the quine code,

  • 1 is converted to $
  • `,d,h,i,l are converted to 0,4,8,9,<

The encoded string forms a long long call chain with encoding rules below;

  • Z -> z( e.g. 1 -> d(
  • z -> z(1, e.g. h -> h(1,
\$\endgroup\$
3
\$\begingroup\$

(,) 46114 17682 14022 12123 11403 11183 9947 Chars or \$9947\log_{256}(3)\approx\$1970.7 Bytes

Less than 10,000 Characters!! Still 2000 characters to go before I can fit it in a url :(

((),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),()())(((),(())()),()()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()()())(((),(())()),())(((),(())()),())(((),(())()),())(((),(())()),()())(((),(())()),()())(((),(())()),()())(((),(())()),()())(()(),()()()()()()()())(()(),(()(),,,,(),,()()()()()))((()),()()())(,,,(()()),(),,()())(,,,(()())())(,,,(()())()()()())(,(,,,(()()))(,,,(()())()),,,(),,()()())(,,,(()())())(,(,,,(()()),(),,()()())(,,,(()())())(,,,(()())()()()())(,,,(()()),(),,()())(,,,(()())(),(),,()())(,,,(()()))(,,,(()())(),(),,()())(,,,(()())()()()())((())(),())((())(),((())())(,,,(()())),,(()())(),(((())))(),((())()))(,,,(()())())(((())),((,,,,,()))(((()))))((()),((()))()),,,(()),((())))((()),()()())((()),((()))(),,(()())(((())),,,,(),,(((())))),(()),((())))

let text = "(()(),()()()()()()()())(()(),(()(),,,,(),,()()()()()))((()),()()())(,,,(()()),(),,()())(,,,(()())())(,,,(()())()()()())(,(,,,(()()))(,,,(()())()),,,(),,()()())(,,,(()())())(,(,,,(()()),(),,()()())(,,,(()())())(,,,(()())()()()())(,,,(()()),(),,()())(,,,(()())(),(),,()())(,,,(()()))(,,,(()())(),(),,()())(,,,(()())()()()())((())(),())((())(),((())())(,,,(()())),,(()())(),(((())))(),((())()))(,,,(()())())(((())),((,,,,,()))(((()))))((()),((()))()),,,(()),((())))((()),()()())((()),((()))(),,(()())(((())),,,,(),,(((())))),(()),((())))";
output = "((),()()())";
for (let c of text){
  output += "(((),(())())," + "()".repeat(c=="(" ? 1 : c==")" ? 2 : 3) + ")";
}
output += text;
out1.innerHTML = output.length + " Chars";
out2.innerHTML = output;
<h1 id=out1></h1>
<p id=out2></p>

Like most esolang quines, there is an encoder and decoder. The decoder is shown below:

(()(),()()()()()()()())(()(),(()(),,,,(),,()()()()()))((()),()()())(,,,(()()),(),,()())(,,,(()())())(,,,(()())()()()())(,(,,,(()()))(,,,(()())()),,,(),,()()())(,,,(()())())(,(,,,(()()),(),,()()())(,,,(()())())(,,,(()())()()()())(,,,(()()),(),,()())(,,,(()())(),(),,()())(,,,(()()))(,,,(()())(),(),,()())(,,,(()())()()()())((())(),())((())(),((())())(,,,(()())),,(()())(),(((())))(),((())()))(,,,(()())())(((())),((,,,,,()))(((()))))((()),((()))()),,,(()),((())))((()),()()())((()),((()))(),,(()())(((())),,,,(),,(((())))),(()),((())))

And in pseudo-code:

a is var[1]
b is var[2]
c is var[a]
d is var[a]+1

b=8
b=b*5;
c=3
(str-output b)*2
str-output b+1, b+4
(str-output b, b+1)*3
str-output b+1
while a>/>=c{
  _=(
  (str-output b)*3
  str-output b+1, b+4
  (str-output b)*2
  (str-output b+1)*2
  str-output b
  (str-output b+1)*2
  str-output b+4
  d=1
  while var[c]+1>/>=d{
    d=d+_=(str-output b)
    str-output b+1
  }
  str-output b+1
  var[c] = var[c]+var[while None>/>=1] // while None>/>=1 is 0, var[0] is input, and EOF is -1, so this is equivilent to var[c] = var[c]-1
  c=c+1
  )
}

c=3
while a>/>=c{
  c=c+1
  str-output b+c*c
}

And the encoder is of the format below:
Once: ((),()()()), and for each char in the decoder: (((),(())()),?) with ? being (), ()(), or ()()() depending on whether the char is (, ), or ,, respectively.

Try It Online!
You have to paste the code yourself, the url was to long otherwise.

\$\endgroup\$
3
\$\begingroup\$

Factor, 56 bytes

"%uUSE: formatting dup printf"USE: formatting dup printf

Try it online!

Inspired by fede s.’s answer.

Explanation:

%uUSE: forma…" String with printf-directive %u to print an unparsed value (wrapping string in quotes) at start of string

USE: formatting Import formatting vocabulary to get printf; string is still on stack.

dup Duplicate the string; now there are two copies on the stack.

printf Print the string with its copy as a formatting argument; the copy is wrapped in quotes and inserted at the start due to %u directive.

\$\endgroup\$
3
\$\begingroup\$

ARBLE, 22 16 bytes

(f%f)"(f%%f)%q"

Essentially the lua quine of s="s=%qprint(s:format(s))"print(s:format(s)). Takes the function f%f (which acts as f:format(f)) and then calls it with the format string "(f%%f)%q, where %q escapes the provided argument.

Try it online!

\$\endgroup\$
1
7 8
9
10 11
16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.