[Question]
      [
Using your language of choice, golf a [quine](http://en.wikipedia.org/wiki/Quine_%28computing%29).
>
> 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](https://codegolf.stackexchange.com/questions/36260/make-an-error-quine) 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>
```

[Answer]
## Python 3, 34 Bytes
```
print((s:='print((s:=%r)%%s)')%s)
```
As far as I'm aware this is shorter than any other published Python 3 quine, mainly by virtue of having been written in the future with respect to most of them, so it can use `:=`.
[Answer]
# Befunge 98 - ~~17~~ 11 characters
```
<@,+1!',k9"
```
Or if using `g` is allowed:
# Befunge 98 - ~~12~~ 10
```
<@,g09,k8"
```
[Answer]
# TECO, 20 bytes
```
<Tab>V27:^TJDV<Esc>V27:^TJDV
```
The `<Esc>` should be replaced with ASCII 0x1B, and the `<Tab>` with 0x09.
* `<Tab>V27:^TJDV<Esc>` inserts the text `<Tab>V27:^TJDV`. This is *not* because there is a text insertion mode which TECO starts in by default. Instead, `<Tab>` *text* `<Esc>` is a special insertion command which inserts a tab, and then the text. A string whose own initial delimiter is part of the text -- very handy.
* `V` prints the current line.
* `27:^T` prints the character with ASCII code 27 without the usual conversion to a printable representation.
* `J` jumps to the beginning of the text.
* `D` deletes the first character (the tab).
* `V` prints the line again.
[Answer]
# Python 2, 31 bytes
```
s="print's=%r;exec s'%s";exec s
```
It's 2 bytes longer than the [shortest Python quine on this question](https://codegolf.stackexchange.com/a/115/21487), but it's much more useful, since you don't need to write everything twice.
For example, to print a program's own source code in sorted order, we can just do:
```
s="print''.join(sorted('s=%r;exec s'%s))";exec s
```
Another example by @feersum can be found [here](https://codegolf.stackexchange.com/a/47198/21487).
## Notes
The reason the quine works is because of `%r`'s behaviour. With normal strings, `%r` puts single quotes around the string, e.g.
```
>>> print "%r"%"abc"
'abc'
```
But if you have a single quotes inside the string, it uses double quotes instead:
```
>>> print "%r"%"'abc'"
"'abc'"
```
This does, however, mean that the quine has a bit of a problem if you want to use both types of quotes in the string.
[Answer]
# [RETURN](https://github.com/molarmanful/RETURN), 18 bytes
```
"34¬§¬§,,,,"34¬§¬§,,,,
```
`[Try it here.](http://molarmanful.github.io/RETURN/)`
First RETURN program on PPCG ever! RETURN is a language that tries to improve DUP by using nested stacks.
# Explanation
```
"34¬§¬§,,,,"         Push this string to the stack
          34       Push charcode of " to the stack
            ¬§¬§     Duplicate top 2 items
              ,,,, Output all 4 stack items from top to bottom
```
[Answer]
# [Factor](http://factorcode.org) -  ~~74~~  ~~69~~ 65 bytes
Works on the listener (REPL):
```
USE: formatting [ "USE: formatting %u dup call" printf ] dup call
```
This is my first ever quine, ~~I'm sure there must be a shorter one!~~ Already shorter. Now I'm no longer sure... (bad pun attempt)
What it does is:
* `USE: formatting` import the `formatting` vocabulary to use `printf`
* `[ "U... printf ]` create a quotation (or lambda, or block) on the top of the stack
* `dup call` duplicate it, and call it
The quotation takes the top of the stack and embeds it into the string as a literal.
Thanks, cat! -> shaved ~~2~~ 4 more bytes :D
[Answer]
# [S.I.L.O.S](http://github.com/rjhunjhunwala/S.I.L.O.S), ~~2642~~ 2593 bytes
**Credits to Rohan Jhunjhunwala for the algorithm.**
```
A = 99
set A 112
A + 1
set A 114
A + 1
set A 105
A + 1
set A 110
A + 1
set A 116
A + 1
set A 76
A + 1
set A 105
A + 1
set A 110
A + 1
set A 101
A + 1
set A 32
A + 1
set A 65
A + 1
set A 32
A + 1
set A 61
A + 1
set A 32
A + 1
set A 57
A + 1
set A 57
A + 1
set A 10
A + 1
set A 67
A + 1
set A 32
A + 1
set A 61
A + 1
set A 32
A + 1
set A 57
A + 1
set A 57
A + 1
set A 10
A + 1
set A 66
A + 1
set A 32
A + 1
set A 61
A + 1
set A 32
A + 1
set A 103
A + 1
set A 101
A + 1
set A 116
A + 1
set A 32
A + 1
set A 67
A + 1
set A 10
A + 1
set A 108
A + 1
set A 98
A + 1
set A 108
A + 1
set A 68
A + 1
set A 10
A + 1
set A 67
A + 1
set A 32
A + 1
set A 43
A + 1
set A 32
A + 1
set A 49
A + 1
set A 10
A + 1
set A 112
A + 1
set A 114
A + 1
set A 105
A + 1
set A 110
A + 1
set A 116
A + 1
set A 32
A + 1
set A 115
A + 1
set A 101
A + 1
set A 116
A + 1
set A 32
A + 1
set A 65
A + 1
set A 32
A + 1
set A 10
A + 1
set A 112
A + 1
set A 114
A + 1
set A 105
A + 1
set A 110
A + 1
set A 116
A + 1
set A 73
A + 1
set A 110
A + 1
set A 116
A + 1
set A 32
A + 1
set A 66
A + 1
set A 10
A + 1
set A 112
A + 1
set A 114
A + 1
set A 105
A + 1
set A 110
A + 1
set A 116
A + 1
set A 76
A + 1
set A 105
A + 1
set A 110
A + 1
set A 101
A + 1
set A 32
A + 1
set A 65
A + 1
set A 32
A + 1
set A 43
A + 1
set A 32
A + 1
set A 49
A + 1
set A 10
A + 1
set A 66
A + 1
set A 32
A + 1
set A 61
A + 1
set A 32
A + 1
set A 103
A + 1
set A 101
A + 1
set A 116
A + 1
set A 32
A + 1
set A 67
A + 1
set A 10
A + 1
set A 105
A + 1
set A 102
A + 1
set A 32
A + 1
set A 66
A + 1
set A 32
A + 1
set A 68
A + 1
set A 10
A + 1
set A 70
A + 1
set A 32
A + 1
set A 61
A + 1
set A 32
A + 1
set A 57
A + 1
set A 57
A + 1
set A 10
A + 1
set A 69
A + 1
set A 32
A + 1
set A 61
A + 1
set A 32
A + 1
set A 103
A + 1
set A 101
A + 1
set A 116
A + 1
set A 32
A + 1
set A 70
A + 1
set A 10
A + 1
set A 108
A + 1
set A 98
A + 1
set A 108
A + 1
set A 71
A + 1
set A 10
A + 1
set A 70
A + 1
set A 32
A + 1
set A 43
A + 1
set A 32
A + 1
set A 49
A + 1
set A 10
A + 1
set A 112
A + 1
set A 114
A + 1
set A 105
A + 1
set A 110
A + 1
set A 116
A + 1
set A 67
A + 1
set A 104
A + 1
set A 97
A + 1
set A 114
A + 1
set A 32
A + 1
set A 69
A + 1
set A 10
A + 1
set A 69
A + 1
set A 32
A + 1
set A 61
A + 1
set A 32
A + 1
set A 103
A + 1
set A 101
A + 1
set A 116
A + 1
set A 32
A + 1
set A 70
A + 1
set A 10
A + 1
set A 105
A + 1
set A 102
A + 1
set A 32
A + 1
set A 69
A + 1
set A 32
A + 1
set A 71
A + 1
printLine A = 99
C = 99
B = get C
lblD
C + 1
print set A
printInt B
printLine A + 1
B = get C
if B D
F = 99
E = get F
lblG
F + 1
printChar E
E = get F
if E G
```
[Try it online!](http://silos.tryitonline.net/#code=QSA9IDk5CnNldCBBIDExMgpBICsgMQpzZXQgQSAxMTQKQSArIDEKc2V0IEEgMTA1CkEgKyAxCnNldCBBIDExMApBICsgMQpzZXQgQSAxMTYKQSArIDEKc2V0IEEgNzYKQSArIDEKc2V0IEEgMTA1CkEgKyAxCnNldCBBIDExMApBICsgMQpzZXQgQSAxMDEKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNjUKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNjEKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNTcKQSArIDEKc2V0IEEgNTcKQSArIDEKc2V0IEEgMTAKQSArIDEKc2V0IEEgNjcKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNjEKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNTcKQSArIDEKc2V0IEEgNTcKQSArIDEKc2V0IEEgMTAKQSArIDEKc2V0IEEgNjYKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNjEKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgMTAzCkEgKyAxCnNldCBBIDEwMQpBICsgMQpzZXQgQSAxMTYKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNjcKQSArIDEKc2V0IEEgMTAKQSArIDEKc2V0IEEgMTA4CkEgKyAxCnNldCBBIDk4CkEgKyAxCnNldCBBIDEwOApBICsgMQpzZXQgQSA2OApBICsgMQpzZXQgQSAxMApBICsgMQpzZXQgQSA2NwpBICsgMQpzZXQgQSAzMgpBICsgMQpzZXQgQSA0MwpBICsgMQpzZXQgQSAzMgpBICsgMQpzZXQgQSA0OQpBICsgMQpzZXQgQSAxMApBICsgMQpzZXQgQSAxMTIKQSArIDEKc2V0IEEgMTE0CkEgKyAxCnNldCBBIDEwNQpBICsgMQpzZXQgQSAxMTAKQSArIDEKc2V0IEEgMTE2CkEgKyAxCnNldCBBIDMyCkEgKyAxCnNldCBBIDExNQpBICsgMQpzZXQgQSAxMDEKQSArIDEKc2V0IEEgMTE2CkEgKyAxCnNldCBBIDMyCkEgKyAxCnNldCBBIDY1CkEgKyAxCnNldCBBIDMyCkEgKyAxCnNldCBBIDEwCkEgKyAxCnNldCBBIDExMgpBICsgMQpzZXQgQSAxMTQKQSArIDEKc2V0IEEgMTA1CkEgKyAxCnNldCBBIDExMApBICsgMQpzZXQgQSAxMTYKQSArIDEKc2V0IEEgNzMKQSArIDEKc2V0IEEgMTEwCkEgKyAxCnNldCBBIDExNgpBICsgMQpzZXQgQSAzMgpBICsgMQpzZXQgQSA2NgpBICsgMQpzZXQgQSAxMApBICsgMQpzZXQgQSAxMTIKQSArIDEKc2V0IEEgMTE0CkEgKyAxCnNldCBBIDEwNQpBICsgMQpzZXQgQSAxMTAKQSArIDEKc2V0IEEgMTE2CkEgKyAxCnNldCBBIDc2CkEgKyAxCnNldCBBIDEwNQpBICsgMQpzZXQgQSAxMTAKQSArIDEKc2V0IEEgMTAxCkEgKyAxCnNldCBBIDMyCkEgKyAxCnNldCBBIDY1CkEgKyAxCnNldCBBIDMyCkEgKyAxCnNldCBBIDQzCkEgKyAxCnNldCBBIDMyCkEgKyAxCnNldCBBIDQ5CkEgKyAxCnNldCBBIDEwCkEgKyAxCnNldCBBIDY2CkEgKyAxCnNldCBBIDMyCkEgKyAxCnNldCBBIDYxCkEgKyAxCnNldCBBIDMyCkEgKyAxCnNldCBBIDEwMwpBICsgMQpzZXQgQSAxMDEKQSArIDEKc2V0IEEgMTE2CkEgKyAxCnNldCBBIDMyCkEgKyAxCnNldCBBIDY3CkEgKyAxCnNldCBBIDEwCkEgKyAxCnNldCBBIDEwNQpBICsgMQpzZXQgQSAxMDIKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNjYKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNjgKQSArIDEKc2V0IEEgMTAKQSArIDEKc2V0IEEgNzAKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNjEKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNTcKQSArIDEKc2V0IEEgNTcKQSArIDEKc2V0IEEgMTAKQSArIDEKc2V0IEEgNjkKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNjEKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgMTAzCkEgKyAxCnNldCBBIDEwMQpBICsgMQpzZXQgQSAxMTYKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNzAKQSArIDEKc2V0IEEgMTAKQSArIDEKc2V0IEEgMTA4CkEgKyAxCnNldCBBIDk4CkEgKyAxCnNldCBBIDEwOApBICsgMQpzZXQgQSA3MQpBICsgMQpzZXQgQSAxMApBICsgMQpzZXQgQSA3MApBICsgMQpzZXQgQSAzMgpBICsgMQpzZXQgQSA0MwpBICsgMQpzZXQgQSAzMgpBICsgMQpzZXQgQSA0OQpBICsgMQpzZXQgQSAxMApBICsgMQpzZXQgQSAxMTIKQSArIDEKc2V0IEEgMTE0CkEgKyAxCnNldCBBIDEwNQpBICsgMQpzZXQgQSAxMTAKQSArIDEKc2V0IEEgMTE2CkEgKyAxCnNldCBBIDY3CkEgKyAxCnNldCBBIDEwNApBICsgMQpzZXQgQSA5NwpBICsgMQpzZXQgQSAxMTQKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNjkKQSArIDEKc2V0IEEgMTAKQSArIDEKc2V0IEEgNjkKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNjEKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgMTAzCkEgKyAxCnNldCBBIDEwMQpBICsgMQpzZXQgQSAxMTYKQSArIDEKc2V0IEEgMzIKQSArIDEKc2V0IEEgNzAKQSArIDEKc2V0IEEgMTAKQSArIDEKc2V0IEEgMTA1CkEgKyAxCnNldCBBIDEwMgpBICsgMQpzZXQgQSAzMgpBICsgMQpzZXQgQSA2OQpBICsgMQpzZXQgQSAzMgpBICsgMQpzZXQgQSA3MQpBICsgMQpwcmludExpbmUgQSA9IDk5CkMgPSA5OQpCID0gZ2V0IEMKbGJsRApDICsgMQpwcmludCBzZXQgQSAKcHJpbnRJbnQgQgpwcmludExpbmUgQSArIDEKQiA9IGdldCBDCmlmIEIgRApGID0gOTkKRSA9IGdldCBGCmxibEcKRiArIDEKcHJpbnRDaGFyIEUKRSA9IGdldCBGCmlmIEUgRw&input=)
[Answer]
# [S.I.L.O.S](http://github.com/rjhunjhunwala/S.I.L.O.S), 3057 bytes
```
A = 99
def S set
S A 112
A + 1
S A 114
A + 1
S A 105
A + 1
S A 110
A + 1
S A 116
A + 1
S A 76
A + 1
S A 105
A + 1
S A 110
A + 1
S A 101
A + 1
S A 32
A + 1
S A 65
A + 1
S A 32
A + 1
S A 61
A + 1
S A 32
A + 1
S A 57
A + 1
S A 57
A + 1
S A 10
A + 1
S A 72
A + 1
S A 32
A + 1
S A 61
A + 1
S A 32
A + 1
S A 56
A + 1
S A 51
A + 1
S A 10
A + 1
S A 112
A + 1
S A 114
A + 1
S A 105
A + 1
S A 110
A + 1
S A 116
A + 1
S A 32
A + 1
S A 100
A + 1
S A 101
A + 1
S A 102
A + 1
S A 32
A + 1
S A 10
A + 1
S A 112
A + 1
S A 114
A + 1
S A 105
A + 1
S A 110
A + 1
S A 116
A + 1
S A 67
A + 1
S A 104
A + 1
S A 97
A + 1
S A 114
A + 1
S A 32
A + 1
S A 72
A + 1
S A 10
A + 1
S A 112
A + 1
S A 114
A + 1
S A 105
A + 1
S A 110
A + 1
S A 116
A + 1
S A 76
A + 1
S A 105
A + 1
S A 110
A + 1
S A 101
A + 1
S A 32
A + 1
S A 32
A + 1
S A 83
A + 1
S A 32
A + 1
S A 10
A + 1
S A 67
A + 1
S A 32
A + 1
S A 61
A + 1
S A 32
A + 1
S A 57
A + 1
S A 57
A + 1
S A 10
A + 1
S A 66
A + 1
S A 32
A + 1
S A 61
A + 1
S A 32
A + 1
S A 103
A + 1
S A 101
A + 1
S A 116
A + 1
S A 32
A + 1
S A 67
A + 1
S A 10
A + 1
S A 108
A + 1
S A 98
A + 1
S A 108
A + 1
S A 68
A + 1
S A 10
A + 1
S A 67
A + 1
S A 32
A + 1
S A 43
A + 1
S A 32
A + 1
S A 49
A + 1
S A 10
A + 1
S A 112
A + 1
S A 114
A + 1
S A 105
A + 1
S A 110
A + 1
S A 116
A + 1
S A 67
A + 1
S A 104
A + 1
S A 97
A + 1
S A 114
A + 1
S A 32
A + 1
S A 72
A + 1
S A 10
A + 1
S A 112
A + 1
S A 114
A + 1
S A 105
A + 1
S A 110
A + 1
S A 116
A + 1
S A 32
A + 1
S A 32
A + 1
S A 65
A + 1
S A 32
A + 1
S A 10
A + 1
S A 112
A + 1
S A 114
A + 1
S A 105
A + 1
S A 110
A + 1
S A 116
A + 1
S A 73
A + 1
S A 110
A + 1
S A 116
A + 1
S A 32
A + 1
S A 66
A + 1
S A 10
A + 1
S A 112
A + 1
S A 114
A + 1
S A 105
A + 1
S A 110
A + 1
S A 116
A + 1
S A 76
A + 1
S A 105
A + 1
S A 110
A + 1
S A 101
A + 1
S A 32
A + 1
S A 65
A + 1
S A 32
A + 1
S A 43
A + 1
S A 32
A + 1
S A 49
A + 1
S A 10
A + 1
S A 66
A + 1
S A 32
A + 1
S A 61
A + 1
S A 32
A + 1
S A 103
A + 1
S A 101
A + 1
S A 116
A + 1
S A 32
A + 1
S A 67
A + 1
S A 10
A + 1
S A 105
A + 1
S A 102
A + 1
S A 32
A + 1
S A 66
A + 1
S A 32
A + 1
S A 68
A + 1
S A 10
A + 1
S A 70
A + 1
S A 32
A + 1
S A 61
A + 1
S A 32
A + 1
S A 57
A + 1
S A 57
A + 1
S A 10
A + 1
S A 69
A + 1
S A 32
A + 1
S A 61
A + 1
S A 32
A + 1
S A 103
A + 1
S A 101
A + 1
S A 116
A + 1
S A 32
A + 1
S A 70
A + 1
S A 10
A + 1
S A 108
A + 1
S A 98
A + 1
S A 108
A + 1
S A 71
A + 1
S A 10
A + 1
S A 70
A + 1
S A 32
A + 1
S A 43
A + 1
S A 32
A + 1
S A 49
A + 1
S A 10
A + 1
S A 112
A + 1
S A 114
A + 1
S A 105
A + 1
S A 110
A + 1
S A 116
A + 1
S A 67
A + 1
S A 104
A + 1
S A 97
A + 1
S A 114
A + 1
S A 32
A + 1
S A 69
A + 1
S A 10
A + 1
S A 69
A + 1
S A 32
A + 1
S A 61
A + 1
S A 32
A + 1
S A 103
A + 1
S A 101
A + 1
S A 116
A + 1
S A 32
A + 1
S A 70
A + 1
S A 10
A + 1
S A 105
A + 1
S A 102
A + 1
S A 32
A + 1
S A 69
A + 1
S A 32
A + 1
S A 71
A + 1
printLine A = 99
H = 83
print def
printChar H
printLine  S
C = 99
B = get C
lblD
C + 1
printChar H
print  A
printInt B
printLine A + 1
B = get C
if B D
F = 99
E = get F
lblG
F + 1
printChar E
E = get F
if E G
```
[Try it online!](http://silos.tryitonline.net/#code=QSA9IDk5CmRlZiBTIHNldCAKUyBBIDExMgpBICsgMQpTIEEgMTE0CkEgKyAxClMgQSAxMDUKQSArIDEKUyBBIDExMApBICsgMQpTIEEgMTE2CkEgKyAxClMgQSA3NgpBICsgMQpTIEEgMTA1CkEgKyAxClMgQSAxMTAKQSArIDEKUyBBIDEwMQpBICsgMQpTIEEgMzIKQSArIDEKUyBBIDY1CkEgKyAxClMgQSAzMgpBICsgMQpTIEEgNjEKQSArIDEKUyBBIDMyCkEgKyAxClMgQSA1NwpBICsgMQpTIEEgNTcKQSArIDEKUyBBIDEwCkEgKyAxClMgQSA3MgpBICsgMQpTIEEgMzIKQSArIDEKUyBBIDYxCkEgKyAxClMgQSAzMgpBICsgMQpTIEEgNTYKQSArIDEKUyBBIDUxCkEgKyAxClMgQSAxMApBICsgMQpTIEEgMTEyCkEgKyAxClMgQSAxMTQKQSArIDEKUyBBIDEwNQpBICsgMQpTIEEgMTEwCkEgKyAxClMgQSAxMTYKQSArIDEKUyBBIDMyCkEgKyAxClMgQSAxMDAKQSArIDEKUyBBIDEwMQpBICsgMQpTIEEgMTAyCkEgKyAxClMgQSAzMgpBICsgMQpTIEEgMTAKQSArIDEKUyBBIDExMgpBICsgMQpTIEEgMTE0CkEgKyAxClMgQSAxMDUKQSArIDEKUyBBIDExMApBICsgMQpTIEEgMTE2CkEgKyAxClMgQSA2NwpBICsgMQpTIEEgMTA0CkEgKyAxClMgQSA5NwpBICsgMQpTIEEgMTE0CkEgKyAxClMgQSAzMgpBICsgMQpTIEEgNzIKQSArIDEKUyBBIDEwCkEgKyAxClMgQSAxMTIKQSArIDEKUyBBIDExNApBICsgMQpTIEEgMTA1CkEgKyAxClMgQSAxMTAKQSArIDEKUyBBIDExNgpBICsgMQpTIEEgNzYKQSArIDEKUyBBIDEwNQpBICsgMQpTIEEgMTEwCkEgKyAxClMgQSAxMDEKQSArIDEKUyBBIDMyCkEgKyAxClMgQSAzMgpBICsgMQpTIEEgODMKQSArIDEKUyBBIDMyCkEgKyAxClMgQSAxMApBICsgMQpTIEEgNjcKQSArIDEKUyBBIDMyCkEgKyAxClMgQSA2MQpBICsgMQpTIEEgMzIKQSArIDEKUyBBIDU3CkEgKyAxClMgQSA1NwpBICsgMQpTIEEgMTAKQSArIDEKUyBBIDY2CkEgKyAxClMgQSAzMgpBICsgMQpTIEEgNjEKQSArIDEKUyBBIDMyCkEgKyAxClMgQSAxMDMKQSArIDEKUyBBIDEwMQpBICsgMQpTIEEgMTE2CkEgKyAxClMgQSAzMgpBICsgMQpTIEEgNjcKQSArIDEKUyBBIDEwCkEgKyAxClMgQSAxMDgKQSArIDEKUyBBIDk4CkEgKyAxClMgQSAxMDgKQSArIDEKUyBBIDY4CkEgKyAxClMgQSAxMApBICsgMQpTIEEgNjcKQSArIDEKUyBBIDMyCkEgKyAxClMgQSA0MwpBICsgMQpTIEEgMzIKQSArIDEKUyBBIDQ5CkEgKyAxClMgQSAxMApBICsgMQpTIEEgMTEyCkEgKyAxClMgQSAxMTQKQSArIDEKUyBBIDEwNQpBICsgMQpTIEEgMTEwCkEgKyAxClMgQSAxMTYKQSArIDEKUyBBIDY3CkEgKyAxClMgQSAxMDQKQSArIDEKUyBBIDk3CkEgKyAxClMgQSAxMTQKQSArIDEKUyBBIDMyCkEgKyAxClMgQSA3MgpBICsgMQpTIEEgMTAKQSArIDEKUyBBIDExMgpBICsgMQpTIEEgMTE0CkEgKyAxClMgQSAxMDUKQSArIDEKUyBBIDExMApBICsgMQpTIEEgMTE2CkEgKyAxClMgQSAzMgpBICsgMQpTIEEgMzIKQSArIDEKUyBBIDY1CkEgKyAxClMgQSAzMgpBICsgMQpTIEEgMTAKQSArIDEKUyBBIDExMgpBICsgMQpTIEEgMTE0CkEgKyAxClMgQSAxMDUKQSArIDEKUyBBIDExMApBICsgMQpTIEEgMTE2CkEgKyAxClMgQSA3MwpBICsgMQpTIEEgMTEwCkEgKyAxClMgQSAxMTYKQSArIDEKUyBBIDMyCkEgKyAxClMgQSA2NgpBICsgMQpTIEEgMTAKQSArIDEKUyBBIDExMgpBICsgMQpTIEEgMTE0CkEgKyAxClMgQSAxMDUKQSArIDEKUyBBIDExMApBICsgMQpTIEEgMTE2CkEgKyAxClMgQSA3NgpBICsgMQpTIEEgMTA1CkEgKyAxClMgQSAxMTAKQSArIDEKUyBBIDEwMQpBICsgMQpTIEEgMzIKQSArIDEKUyBBIDY1CkEgKyAxClMgQSAzMgpBICsgMQpTIEEgNDMKQSArIDEKUyBBIDMyCkEgKyAxClMgQSA0OQpBICsgMQpTIEEgMTAKQSArIDEKUyBBIDY2CkEgKyAxClMgQSAzMgpBICsgMQpTIEEgNjEKQSArIDEKUyBBIDMyCkEgKyAxClMgQSAxMDMKQSArIDEKUyBBIDEwMQpBICsgMQpTIEEgMTE2CkEgKyAxClMgQSAzMgpBICsgMQpTIEEgNjcKQSArIDEKUyBBIDEwCkEgKyAxClMgQSAxMDUKQSArIDEKUyBBIDEwMgpBICsgMQpTIEEgMzIKQSArIDEKUyBBIDY2CkEgKyAxClMgQSAzMgpBICsgMQpTIEEgNjgKQSArIDEKUyBBIDEwCkEgKyAxClMgQSA3MApBICsgMQpTIEEgMzIKQSArIDEKUyBBIDYxCkEgKyAxClMgQSAzMgpBICsgMQpTIEEgNTcKQSArIDEKUyBBIDU3CkEgKyAxClMgQSAxMApBICsgMQpTIEEgNjkKQSArIDEKUyBBIDMyCkEgKyAxClMgQSA2MQpBICsgMQpTIEEgMzIKQSArIDEKUyBBIDEwMwpBICsgMQpTIEEgMTAxCkEgKyAxClMgQSAxMTYKQSArIDEKUyBBIDMyCkEgKyAxClMgQSA3MApBICsgMQpTIEEgMTAKQSArIDEKUyBBIDEwOApBICsgMQpTIEEgOTgKQSArIDEKUyBBIDEwOApBICsgMQpTIEEgNzEKQSArIDEKUyBBIDEwCkEgKyAxClMgQSA3MApBICsgMQpTIEEgMzIKQSArIDEKUyBBIDQzCkEgKyAxClMgQSAzMgpBICsgMQpTIEEgNDkKQSArIDEKUyBBIDEwCkEgKyAxClMgQSAxMTIKQSArIDEKUyBBIDExNApBICsgMQpTIEEgMTA1CkEgKyAxClMgQSAxMTAKQSArIDEKUyBBIDExNgpBICsgMQpTIEEgNjcKQSArIDEKUyBBIDEwNApBICsgMQpTIEEgOTcKQSArIDEKUyBBIDExNApBICsgMQpTIEEgMzIKQSArIDEKUyBBIDY5CkEgKyAxClMgQSAxMApBICsgMQpTIEEgNjkKQSArIDEKUyBBIDMyCkEgKyAxClMgQSA2MQpBICsgMQpTIEEgMzIKQSArIDEKUyBBIDEwMwpBICsgMQpTIEEgMTAxCkEgKyAxClMgQSAxMTYKQSArIDEKUyBBIDMyCkEgKyAxClMgQSA3MApBICsgMQpTIEEgMTAKQSArIDEKUyBBIDEwNQpBICsgMQpTIEEgMTAyCkEgKyAxClMgQSAzMgpBICsgMQpTIEEgNjkKQSArIDEKUyBBIDMyCkEgKyAxClMgQSA3MQpBICsgMQpwcmludExpbmUgQSA9IDk5CkggPSA4MwpwcmludCBkZWYgCnByaW50Q2hhciBICnByaW50TGluZSAgUyAKQyA9IDk5CkIgPSBnZXQgQwpsYmxECkMgKyAxCnByaW50Q2hhciBICnByaW50ICBBIApwcmludEludCBCCnByaW50TGluZSBBICsgMQpCID0gZ2V0IEMKaWYgQiBECkYgPSA5OQpFID0gZ2V0IEYKbGJsRwpGICsgMQpwcmludENoYXIgRQpFID0gZ2V0IEYKaWYgRSBH&input=)
I am ashamed to say this took me a while to write even though most of it was generated by another java program. Thanks to @MartinEnder for helping me out. This is the first quine I have ever written. **Credits go to Leaky Nun** for most of the code. I "borrowed his code" which was originally inspired by mine. My answer is similar to his, except it shows the "power" of the preprocessor. Hopefully this approach can be used to golf of bytes if done correctly. The goal was to prevent rewriting the word "set" 100's of times.

**Please check out his [much shorter answer!](https://codegolf.stackexchange.com/a/91283/46918)**
[Answer]
# [‡≤†\_‡≤†](https://codegolf.meta.stackexchange.com/a/7390/41247), 6 bytes
```
‡≤†‡≤†
```
This used to work back when the interpreter was still buggy but that's fixed now. However, you can try it in the [legacy version of the interpreter](http://codepen.io/molarmanful/debug/rxJmqx)!
[Answer]
# [Husk](https://github.com/barbuz/Husk), 8 bytes
```
S+s"S+s"
```
[Try it online!](https://tio.run/##yygtzv7/P1i7WAmE//8HAA "Husk ‚Äì Try It Online")
Husk is a new golfing functional language created by me and [Zgarb](https://chat.stackexchange.com/users/136121). It is based on Haskell, but has an intelligent inferencer that can "guess" the intended meaning of functions used in a program based on their possible types.
### Explanation
This is a quite simple program, composed by just three functions:
`S` is the S combinator from [SKI (typed) combinator calculus](https://en.wikipedia.org/wiki/SKI_combinator_calculus): it takes two functions and a third value as arguments and applies the first function to the value and to the second function applied to that value (in code: `S f g x = f x (g x)`).
This gives us `+"S+s"(s"S+s")`. `s` stands for `show`, the Haskell function to convert something to a string: if show is applied to a string, special characters in the string are escaped and the whole string is wrapped in quotes.
We get then `+"S+s""\"S+s\""`. Here, `+` is string concatenation; it could also be numeric addition, but types wouldn't match so the other meaning is chosen by the inferencer.
Our result is then `"S+s\"S+s\""`, which is a string that gets printed simply as `S+s"S+s"`.
[Answer]
## [Bash](https://www.gnu.org/software/bash/), 48 bytes
```
Q=\';q='echo "Q=\\$Q;q=$Q$q$Q;eval \$q"';eval $q
```
[Try it online!](https://tio.run/##S0oszvj/P9A2Rt260FY9NTkjX0EJyItRCQTyVQJVCoGM1LLEHIUYlUIldQhTpfD/fwA "Bash ‚Äì Try It Online")
[Answer]
# [Reflections](https://thewastl.github.io/Reflections/), 1.81x10375 bytes
Or to be more accurate, `1807915590203341844429305353197790696509566500122529684898152779329215808774024592945687846574319976372141486620602238832625691964826524660034959965005782214063519831844201877682465421716887160572269094496883424760144353885803319534697097696032244637060648462957246689017512125938853808231760363803562240582599050626092031434403199296384297989898483105306069435021718135129945` bytes.
The relevant section of code is:
```
+#::(1   \/  \    /: 5;;\
          >v\>:\/:4#+     +\
     /+#   /   2 /4):_    ~/
     \ _   2:#_/ \  _(5#\ v#_\
         *(2 \;1^    ;;4) :54/
         \/ \    1^X    \_/
```
Where each line is preceeded by `451978897550835461107326338299447674127391625030632421224538194832303952193506148236421961643579994093035371655150559708156422991206631165008739991251445553515879957961050469420616355429221790143067273624220856190036088471450829883674274424008061159265162115739311672254378031484713452057940090950890560145649762656523007858600799824096074497474620776326517358755429533782443` spaces. The amount of spaces is a base 128 encoded version of the second part, with 0 printing all the spaces again.
Edit: H.PWiz points out that the interpreter probably doesn't support this large an integer, so this is all theoretical
### How It Works:
```
+#::(1  Pushes the addition of the x,y coordinates (this is the extremely large number)
        Dupe the number a couple of times and push one of the copies to stack 1
            \
             >
                   Pushes a space to stack 2
            *(2
            \/
             /  \
             >v >:\
        /+#   /   2   Print space number times
        \ _   2:#_/
                #      Pop the extra 0
                \;1^   Switch to stack 1 and start the loop
                   /:4#+      +\
                    /4):_     ~/    Divide the current number by 128
                    \  _(5#\ v      Mod a copy by 128
                   ^      4) :
                           \_/
                             v#_\  If the number is not 0:
                   ^    ;;4) :54/  Print the number and re-enter the loop
                     /: 5;;\
             v\      4             If the number is 0:
                     4             Pop the excess 0
              :            \       And terminate if the divided number is 0
                                   Otherwise return to the space printing loop
              \     1^X
```
Conclusion: Can be golfed pretty easily, but maybe looking for a better encoding algorithm would be best. Unfortunately, there's basically no way to push an arbitrarily large number without going to that coordinate.
[Answer]
# [Brain-Flak](https://github.com/DJMcMayhem/Brain-Flak), 1805 bytes
```
(())(()()()())(())(())(()()())(())(())(()()()())(())(())(()()()())(())(()()())(()())(()()())(())(()()()())(())(())(())(())(())(()())(()()()())(()())(()()())(())(()()()())(())(())(()()()())(())(()()())(()())(())(()()())(()()())(())(())(()()())(())(())(())(())(())(()()()())(())(())(()()())(())(())(())(()()())(()()())(()()()())(())(()()())(()())(())(()()())(())(())(())(())(())(()()())(()()()())(())(()())(())(()()())(()())(()()())(()()()())(())(()()())(())(())(())(())(()()())(()()()())(()())(())(()())(()()())(())(()())(()())(())(())(())(())(())(())(())(()())(())(()()())(())(())(()())(())(())(())(())(()()()())(()())(())(()()())(())(())(()()())(()())(())(()()())(()())(())(())(())(()())(())(())(()()())(()())(()())(()()()()())(()())(()())(()())(()()()())(())(())(()()())(())(())(()()())(()())(())(())(()()())(()())(()())(())(())(()()())(())(())(()())(())(()())(())(()())(())(()())(())(()())(()())(()())(()())(()()()())(())(()())(())(()()())(()())(()())(()()()())(()())(())(())(()())(()()()()())(()()())(())(()())(()())(())(())(())(()()())(())(())(()()()())(())(())(()()()())(())(()()())(()())(()()())(())(()()()())(())(())(()()()())(())(())(())(())(()())(()()()()())(())(())(()())(())(()()())(()())(()())(()())(())(()()()())(())(())(()())(())(()()())(()())(()()())(()()()())(())(()())(())(())(())(()()())(()()()()())(()())(()())(())(()()()())(())(())(())(()())(()()()()())(())(())(()())(())(()()())(())(())(()()())(())(())(()()())(())(())(()())(())(()())(())(()())(())(()())(())(()())(()())(()())(()())(()())(()())(())(()()()())(()()()){<>(((((()()()()()){}){}){}())[()])<>(([{}])()<{({}())<>((({}())[()]))<>}<>{({}<>)<>}{}>)((){[()](<(({}()<(((()()()()()){})(({})({}){})<((([(({})())]({}({}){}(<>)))()){}())>)>))((){()(<{}>)}{}<{({}()<{}>)}>{}({}<{{}}>{})<>)>)}{}){{}({}<>)<>{(<()>)}}<>{({}<>)<>}{}}<>
```
[Try it online!](https://tio.run/##tVNJDsIwDLzzkvjQH0SReEfVQzkgIRAHrlbeHuwYVDWL4wrRhTrjZcYmubzW23O6PtZ7Ss4B0Cs3uO1trTXka9fZdea@yj7Gkq8x7xG9p3F/rajya1HSY2zV0CfaZhzXbk28RHpK@9pqT3um@r7S@u6zlPPZGFu4fZfbmMaTsFgjjZZuW5rqWYz/7X@eeG2nllqtvWtsx86QfnqsrEe7sa9/3VE95fmLPrh8bbIxykPm7GABjpgxLuTz6DKek7YIWkcf2OcD2xgDEyA7nZdIX5EwDk7Y2DsLAJRDCSKB6oGE00@gO9elCp45iOijSJYh53nEyCYpgRwDKDhrQ9LDaKGXjFNKaTq/AQ "Brain-Flak ‚Äì Try It Online")
*-188 bytes by avoiding code duplication*
Like Wheat Wizard's answer, I encode every closing bracket as 1. The assignment of numbers to the four opening brackets is chosen to minimize the total length of the quine:
```
2: ( - 63 instances
3: { - 41 instances
4: < - 24 instances
5: [ -  5 instances
```
The other major improvement over the old version is a shorter way to create the code points for the various bracket types.
The decoder builds the entire quine on the second stack, from the middle outward. Closing brackets that have yet to be used are stored below a 0 on the second stack. Here is a full explanation of an earlier version of the decoder:
```
# For each number n from the encoder:
{
 # Push () on second stack (with the opening bracket on top)
 <>(((((()()()()()){}){}){}())[()])<>
 # Store -n for later
 (([{}])
  # n times
  {<({}())
    # Replace ( with (()
    <>((({}())[()]))<>
  >}{}
  # Add 1 to -n
  ())
  # If n was not 1:
  ((){[()]<
     # Add 1 to 1-n
     (({}())<
       # Using existing 40, push 0, 91, 60, 123, and 40 in that order on first stack
       <>(({})<(([(({})())]((()()()()()){})({}{}({})(<>)))({})()()())>)
     # Push 2-n again
     >)
     # Pop n-2 entries from stack
     {({}()<{}>)}{}
     # Get opening bracket and clear remaining generated brackets
     (({}<{{}}>{})
      (<
        # Add 1 if n was 2; add 2 otherwise
        # This gives us the closing bracket
        ({}(){()(<{}>)}
         # Move second stack (down to the 0) to first stack temporarily and remove the zero
         <<>{({}<>)<>}{}>
        # Push closing bracket
        )
      # Push 0
      >)
     # Push opening bracket
     )
     # Move values back to second stack
     <>{({}<>)<>}
   # Else (i.e., if n = 1):
   >}{})
 {
  # Create temporary zero on first stack
  (<{}>)
  # Move second stack over
  <>{({}<>)<>}
  # Move 0 down one spot
  # If this would put 0 at the very bottom, just remove it
  {}({}{(<()>)})
  # Move second stack values back
  <>{({}<>)<>}}{}
}
# Move to second stack for output
<>
```
[Answer]
# [APL (Dyalog Unicode)](https://www.dyalog.com/), 18 [bytes](https://codegolf.meta.stackexchange.com/a/9429/43319 "When can APL characters be counted as 1 byte each?")[SBCS](https://github.com/abrudz/SBCS ".dyalog files using a single byte character set")
[@ngn's updated version](https://chat.stackexchange.com/transcript/message/48380903#48380903 "The APL Orchard") of the [classic APL quine](https://codegolf.stackexchange.com/a/70520/43319 "APL, 22 bytes ‚Äì Alex A."), using a modern operator to save four bytes.
```
1‚åΩ,‚ç®9‚ç¥'''1‚åΩ,‚ç®9‚ç¥'''
```
[Try APL!](https://tryapl.org/?a=1%u233D%2C%u23689%u2374%27%27%271%u233D%2C%u23689%u2374%27%27%27&run "tryapl.org/?a=1‚åΩ,‚ç®9‚ç¥'''1‚åΩ,‚ç®9‚ç¥'''")
`'''1‚åΩ,‚ç®9‚ç¥'''`‚ÄÉthe characters `'1‚åΩ,‚ç®9‚ç¥'`
`9‚ç¥`‚ÄÉcyclically **r**eshape to shape 9; `'1‚åΩ,‚ç®9‚ç¥''`
`,‚ç®`‚ÄÉconcatenation selfie; `'1‚åΩ,‚ç®9‚ç¥'''1‚åΩ,‚ç®9‚ç¥''`
`1‚åΩ`‚ÄÉcyclically rotate one character to the left; `1‚åΩ,‚ç®9‚ç¥'''1‚åΩ,‚ç®9‚ç¥'''`
[Answer]
# [Alchemist](https://github.com/bforte/Alchemist), ~~720 657 637~~ 589 bytes
*-68 bytes thanks to Nitrodon!*
```
0n0n->1032277495984410008473317482709082716834303381684254553200866249636990941488983666019900274253616457803823281618684411320510311142825913359041514338427283749993903272329405501755383456706244811330910671378512874952277131061822871205085764018650085866697830216n4+Out_"0n0n->"+Out_n4+nn+n0n
4n0+4n0+n->Out_"n"
n+n+4n0+n0+n0+n0->Out_"+"
n+n+n+4n0+n0+n0->Out_n
4n+4n0+n0->Out_"4"
4n+n+4n0->Out_"\""
4n+n+n+n0+n0+n0->Out_"->"
4n+n+n+n+n0+n0->Out_"\n"
4n+4n+n0->Out_"Out_"
4n+4n+n->Out_"\\"
nn->4n0+4n0+nnn
n0+n4->n
nnn+4n+4n+n4->nn+n00
nnn+0n4->n+n40
n40+0n00+n4->n4+nn
n40+0n+n00->n4+n40
```
[Try it online!](https://tio.run/##XZBZagMxEET/fYz5HQy9q/WTK@QChhCSQAyJHLBz/UxKM7KzwCzqV6Xukh7fnl5f3o/ny7JQo7a/Y1KRUqx6TTMmorSiysVSClXClyPVlFQTKxM3dxX4IsRqaNRK1dgya2pEEAOQFDg1OMxLkqaoYDtn9CmM/Y7JzGyS4pVVvZKxs2GMSZFUZKpVK/IVbK5G7sQFs5HGoxCmW6KVUmWKwlrSWbIfpZ@IFZRTQBjTKL2EEQI4ojvCRy2pJBzN5vvPy8O0Xci0FmCtzQA7azT3F9LqatMOwobGM5R5U35pm9B7DDacNnW0wkEO00Dtf1ckuil/hEObtsY/aP1c4dV2QCwUt3O0tus/299h0VZvt/e6t6IV0lqDojRCSWNLv5eBunkjRsvydfq4HE/tvOyfvwE "Alchemist ‚Äì Try It Online")
Warning, takes far longer than the lifetime of the universe to execute, mostly cause we have to transfer that rather large number on the first line back and forth between multiple atoms repeatedly. [Here's a version](https://tio.run/##tZBbbsMgEEX/vQz/WpYGDLb5yRa6gUhV1VZqpJZUSrr9umBIGj/APMZSHjDD3Ln3vHy@frx/nS7XYQAJsj5QThkF3vWE8o42HaMtFS0XXADrW9J0hHNBiGgBeN8z4K0ggjdENE3fENXnAJQy0lDJqqef63NpdMvxompSVqpQMAmV/qrW@EqWhWqYkv3YTmU6Dz3T0Bq2Zl@yUpfGoq0cS1uSc1Xl6N6ZNI6yNML/pfHnVrw9Oypb6nLPIWWh/1h9UAc5vtXP9V1LwViE8a6q6spAXcGOaC62pB@bCoNBDwkwY@pIQI8UcDvpN/VBn5kRNc8nA48j06Hl2GxwOjofXhtfCMwlliLrMitCS6k1MZfcquCa5LqoW9YhvC7tEvfJOxe4VriX@Nd4FrlX@ZZtrfMu9K30L91eu7HYv3precj6TQNbFrZNhNkIMLJtJcRMqJ0gQyGWwkyF2wo0FmYt1FyMvWCDoRbDTcbZjDAabjXGbKzdKMMxluNMx9uONB5nPdZ8iv3oALER4kOkxUgIEh8lJUxqnKRAKZHSQqXHSgyWFi01XE685ICpEdND5sXMCJoeNSdsbtyswDmR80Lnx84Mnhc9NzxG/GwAuQjyIeBgQACRjwIDBhYOFCAYSHCg4GFBAoODBgsOJh40QFiI8CDhYkIEhYcKExY2LlRgmMhwoeFjQwaHiw4b3h740AFiI8SHuA/GHUDio9wD5h3n8Hv@vp7O8jLUb38) that outputs the first few lines in a reasonable amount of time.
[Here is the encoder](https://tio.run/##ZZHtboIwFIb/cxWkIwukgv3RLJlmhDvYBagxbrLEDQoBNSxEb52957SizgROe57z9ny0dd4UL8NQ/vpBWxya2n/zeZ17HljWwV8IIya@kGQUGU1mKcjGKe9Z8H7Yr9lbihWOP/HhrEvaqtmHfWzzJ59V@REG6@gUQdNuqEZSowl7Ik2T515oI0UXBlL6293R19FZjKCstgy0UYTCrIulDKKr8B5f5MbEKfXXh2fU5oIncUI1dECVqZHbBqdZN42S72pn3EUUmOVRUG7qsMcAX7um3WOqyewHgyVNfsybNp/bvBlmo3X2usiK1XwYjJZ8V8ootCXYATNGAng0Gf2uY1y@h4BF7nMRaSM3MRugHI45pRaEGDqC57PI/M@KjsbIXQCvbBNfEZsLvMiWaAvOOIcxHi06TrExrCU5@ZRKMVTsg8LVCq5yR@heHCKxJVr9AQ) that turns the program into the data section
Everything but the large number on the first line is encoded using these ~~8~~ 9 tokens:
```
0 n + -> " \n Out_ \ 4
```
That's why all the atom names are composed of just `n`,`0` and `4`.
As a bonus, this is now fully deterministic in what order the rules are executed.
### Explanation:
```
Initialise the program
0n0n->        If no n0n atom (note we can't use _-> since _ isn't a token)
      n4+Out_"0n0n->"+Out_n4+nn4+n0n
      NUMn4           Create a really large number of n4 atoms
      +Out_"0n0n->"   Print the leading "0n0n->"
      +Out_n4         Print the really large number
      +nn             Set the nn flag to start getting the next character
      +n0n            And prevent this rule from being called again
Divmod the number by 9 (nn and nnn flag)
nn->4n0+4n0+nnn          Convert the nn flag to 8 n0 atoms and the nnn flag
n0+n4->n                 Convert n4+n0 atoms to an n atom
nnn+4n+4n+n4->nn+n00     When we're out of n0 atoms, move back to the nn flag
                         And increment the number of n00 atoms
nnn+0n4->n+n40           When we're out of n4 atoms, add another n atom and set the n40 flag
Convert the 9 possible states of the n0 and n atoms to a token and output it (nn flag)
n+4n0+4n0->Out_"n"           1n+8n0 -> 'n'
n+n+4n0+n0+n0+n0->Out_"+"    2n+7n0 -> '+'
n+n+n+4n0+n0+n0->Out_n       3n+6n0 -> '0'
4n+4n0+n0->Out_"4"           4n+5n0 -> '4'
4n+n+4n0->Out_"\""           5n+4n0 -> '"'
4n+n+n+n0+n0+n0->Out_"->"    6n+3n0 -> '->'
4n+n+n+n+n0+n0->Out_"\n"     7n+2n0 -> '\n'
4n+4n+n0->Out_"Out_"         8n+1n0 -> 'Out_'
4n+4n+n->Out_"\\"            9n+0n0 -> '\'
Reset (n40 flag)
n40+0nn+n00->n4+n40    Convert all the n00 atoms back to n4 atoms
n40+0n00+n4->n4+nn     Once we're out of n00 atoms set the nn flag to start the divmod
```
[Answer]
# [Brian & Chuck](https://github.com/m-ender/brian-chuck), ~~211 143 138 133 129 98 86~~ 84 bytes
```
?.21@@/BC1@c/@/C1112BC1BB/@c22B2%C@!{<?
!.>.._{<+>>-?>.---?+<+_{<-?>+<<-.+?√ø
```
[Try it online!](https://tio.run/##SyrKTMzTTc4oTc7@/9@ekVHPyNDBQd/J2dChPlnfQd/Z0NDQCMhzctIHChgZORmp8jk71CsyV9vYcynq2enpxVfbaNvZ6drb6enq6tpr22gDBYA8bRsbXT1t@8P7//8HAA "Brian & Chuck ‚Äì Try It Online")
old version:
```
?{<^?_>{_;?_,<_-+_;._;}_^-_;{_^?_z<_>>_->_->_*}_-<_^._=+_->_->_->_-!_	?_;}_^_}<?
!.>.>.>.+>._<.}+>.>.>?<{?_{<-_}<.<+.<-?<{??`?=
```
[Try it online!](https://tio.run/##LYuxDsJADEPVEf6iKyH5gXOTPzkDXUBIDEgsRPftR3tC9uJn@/Z@XF@63j/rs/dI1KAnS/AMqrAYS2NVluRWfUF36vCpUcFqXORPds88xLhMExviOJsPiRthTUYKZDCh28IgBt1BXGLp/Qc "Brian & Chuck ‚Äì Try It Online")
New code. Now the data isn't split into nul separated chunks, but the nul will be pulled through the data.
```
Brian:
?                   start Chuck
.21@@/BC1@c/@/C1112BC1BB/@c22B2%C@!
                    data. This is basically the end of the Brian code and the Chuck code reversed
                    and incremented by four. This must be done because the interpreter tries
                    to run the data, so it must not contain runnable characters
                    ASCII 3 for marking the end of the code section
{<?                 loop the current code portion of Chuck
Chuck:
code 1 (print start of Brian code)
.>..               print the first 3 characters of Brian
code 2 (print the data section)
{<+>>-              increment char left to null and decrement symbol right to null
                    for the first char, this increments the question mark and decrements the
                    ASCII 1. So the question mark can be reused in the end of the Chuck code
?>.                 if it became nul then print the next character
---?+<+             if the character is ASCII 3, then the data section is printed.
                    set it 1, and set the next char to the left 1, too
code 3 (extract code from data)
{<-                 decrement the symbol left to the nul
?>+<<-.             if it became nul then it is the new code section marker, so set the old one 1
                    and print the next character to the left
+?                  if all data was processed, then the pointer can't go further to the left
                    so the char 255 is printed. If you add 1, it will be null and the code ends.
√ø                   ASCII 255 that is printed when the end of the data is reached
```
[Answer]
# [Klein](https://github.com/Wheatwizard/Klein), 330 bytes
```
"![	.;	=90*/[	.9(#;	=[>[.	>1#	98='9[	'7[.>;	[*;	)	=#0,*[	=.>9(.	=*(#(#([	.0#8;#(#;	[*9>[;	=> [*?	[9(;;"\
/																																																																																<
>:1+0\
 /:)$<
>\?\ /
?2 $
:9>(:\
(8\/?<
\+ <
 *
 >$1-+\
>/?:) /
 >+)$)$)\
/1$9<$)$<
\+:?\<
>?!\+@
\:)<<
```
[Try it online!](https://tio.run/##vc5NbgMhDAXgtX0JSEAKAw0w3XT4GdOew952UbXK/XeEXKJ@qyc9ffLv3/fPY87rhSE2OEv2iUHF4sxqTKwi0K4MlOO8FYbbB0dqwF41UBuo0@Q3z3BGKm5N1emdWVlYNkczL4V9IV4YafYDuLjWroIJ/vU6Ut1DFtSpbnY1GaITjndtsRZyVdAdkkZHCbqj9qjJ7vcgSGnUbU01hc2urNd3W7p9KRLqkIWNi4RPlLr1jnPOPed5/3oC "Klein ‚Äì Try It Online")
This works in all topologies, mostly by completely avoiding wrapping. The first list encodes the rest of the program offset by one, so newlines are the unprintable  (11).
[Answer]
# [ed(1)](https://kidneybone.com/c2/wiki/EdIsTheStandardTextEditor), 45 bytes
We have quines for `TECO`, `Vim`, and `sed`, but not the almighty `ed`?! This travesty shall not stand. (NB: See also, this [error quine](https://codegolf.stackexchange.com/a/36286/15940) for `ed`)
[Try it Online!](https://tio.run/##S035/z@RK5FLh0unxJBLRdekWF9HX0@fS6eAK5BLD4vg//8A)
```
a
a
,
,t1
$-4s/,/./
,p
Q
.
,t1
$-4s/,/./
,p
Q
```
Stolen from [here](https://github.com/tpenguinltg/ed1-quine/blob/master/quine.ed). It should be saved as a file `quine.ed` then run as follows: (TIO seems to work a bit differently)
```
$ ed < quine.ed
```
[Answer]
# [Grok](https://github.com/AMiller42/Grok-Language), 42 bytes
```
iIilWY!}I96PWwI10WwwwIkWwwwIhWq``
   k   h
```
[Try it Online!](http://grok.pythonanywhere.com?flags=&code=iIilWY!%7DI96PWwI10WwwwIkWwwwIhWq%60%60%0A%20%20%20k%20%20%20h&inputs=)
It is very costly to output anything in Grok it seems.
[Answer]
# [!@#$%^&\*()\_+](https://github.com/ConorOBrien-Foxx/ecndpcaalrlp), ~~1128~~ ~~1116~~ ~~1069~~ ~~960~~ ~~877~~ ~~844~~ ~~540~~ ~~477~~ ~~407~~ ~~383~~ 33 bytes
**Edit**: Woah... -304 B with space
**Edit 2**: Bruh.
**Edit 3**: Thanks Jo King for the idea! I outgolfed ya!
A stack-based language(The first on TIO's list!)
It's a big pile of unprintables though
```
N0N  (!&+$*)^(!&@^)!
```
(Spaces are `NUL` bytes)
[Try it online!](https://tio.run/##S03OSylITkzMKcop@P9f0s9ATFDCT1JKRJoByGAQ0FBUE9BW0dKMAzIc4jQV//8HAA)
Here's the code, but in Control Pictures form:
```
‚êôN0‚êñ‚êë‚êòN‚êô‚êö‚êî‚êõ‚êÄ‚êñ‚êë‚êò‚êÄ‚êê(!&‚êê+$*)^(!&@^)!
```
## Explanation
```
‚êôN0‚êñ‚êë‚êòN‚êô‚êö‚êî‚êõ‚êÄ‚êñ‚êë‚êò‚êÄ‚êê                 Data
                 (!&‚êê+$*)         Push the stack, reversed and +16 back on top
                         ^(!&@^)! Print everything reversed, including the length (Hence the final `!`)
```
It does error on overflow though...
[Answer]
# Commodore Basic, ~~54~~ 41 characters
```
1R‚îÄA$:?A$C|(34)A$:D‚ô†"1R‚îÄA$:?A$C|(34)A$:D‚ô†
```
Based on DLosc's QBasic quine, but modified to take advantage of Commodore Basic's shortcut forms. In particular, the shorter version of `CHR$(34)` makes using it directly for quotation marks more efficient than defining it as a variable.
As usual, I've made substitutions for PETSCII characters that don't appear in Unicode: `‚ô†` = `SHIFT+A`, `‚îÄ` = `SHIFT+E`, `|` = `SHIFT+H`.
**Edit:** You know what? If a string literal ends at the end of a line, the Commodore Basic interpreter will let you leave out the trailing quotation mark. Golfed off 13 characters.
Alternatively, if you want to skirt the spirit of the rules,
```
1 LIST
```
`LIST` is an instruction that prints the current program's code. It is intended for use in immediate mode, but like all immediate-mode commands, it can be used in a program (eg. `1 NEW` is a self-deleting program). Nothing shorter is possible: dropped spaces or abbreviated forms get expanded by the interpreter and displayed at full length.
[Answer]
# Jolf, 4 bytes
```
Q¬´Q¬´
Q    double (string)
 ¬´   begin matched string
  Q¬´ capture that
```
This transpiles to `square(`Q¬´`)` (I accidentally did string doubling in the `square` function), which evaluates to `Q¬´Q¬´`. Note that `q` is the quining function in Jolf, *not* `Q` ;).
[Answer]
# [Vitsy](https://github.com/VTCAKAVSMoACE/Vitsy), ~~11~~ ~~9~~ ~~8~~ 6 Bytes
This programming language was obviously made past the date of release for this question, but I thought I'd post an answer so I can a) get more used to it and b) figure out what else needed to be implemented.
```
'rd3*Z
```
The explanation is as follows:
```
'rd3*Z
'           Start recording as a string.
(wraps around once, capturing all the items)
'           Stop recording as a string. We now have everything recorded but the original ".
 r          Reverse the stack
  b3*       This equates the number 39 = 13*3 (in ASCII, ')
     Z      Output the entire stack.
```
[Answer]
# Fuzzy Octo Guacamole, 4 bytes
```
_UNK
```
I am not kidding. Due to a suggestion by @ConorO'Brien, `K` prints `_UNK`. The `_UN` does nothing really, but actually sets the temp var to `0`, pushes `0`, and pushes `None`.
The `K` prints "\_UNK", and that is our quine.
[Answer]
# C++, ~~286~~ ~~284~~ 236 bytes
Now with extra golf!
```
#include<iostream>
int main(){char a[]="#include<iostream>%sint main(){char a[]=%s%s%s,b[]=%s%s%s%s,c[]=%s%sn%s,d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}",b[]="\"",c[]="\n",d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}
```
I'm currently learning C++, and thought "Hey, I should make a quine in it to see how much I know!" 40 minutes later, I have this, a full ~~64~~ **114** bytes shorter than [the current one](https://codegolf.stackexchange.com/questions/69/golf-you-a-quine-for-great-good/2431#2431). I compiled it as:
```
g++ quine.cpp
```
Output and running:
```
C:\Users\Conor O'Brien\Documents\Programming\cpp
Œª g++ quine.cpp & a
#include<iostream>
int main(){char a[]="#include<iostream>%sint main(){char a[]=%s%s%s,b[]=%s%s%s%s,c[]=%s%sn%s,d[]=%s%s%s%s;printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}",b[]="\"",c[]="\n",d[]="\\";printf(a,c,b,a,b,b,d,b,b,b,d,b,b,d,d,b);}
```
[Answer]
# [Cheddar](https://github.com/cheddar-lang/Cheddar), 56 bytes
```
var a='var a=%s;print a%@"39+a+@"39';print a%@"39+a+@"39
```
[**Try it online!**](http://cheddar.tryitonline.net/#code=dmFyIGE9J3ZhciBhPSVzO3ByaW50IGElQCIzOSthK0AiMzknO3ByaW50IGElQCIzOSthK0AiMzk&input=)
I felt like trying to make something in Cheddar today, and this is what appeared...
[Answer]
# 05AB1E, ~~16~~ 17 bytes
```
"34√ßs¬´DJ"34√ßs¬´DJ
```
With trailing newline.
[Try it online!](http://05ab1e.tryitonline.net/#code=IjM0w6dzwqtESiIzNMOnc8KrREoK&input=)
**Explanation:**
```
"34√ßs¬´DJ"        # push string
         34√ß     # push "
            s¬´   # swap and concatenate
              DJ # duplicate and concatenate
```
[Answer]
# [05AB1E](http://github.com/Adriandmen/05AB1E), 19 bytes
*Thanks to @Oliver for a correction (trailing newline)*
```
"D34√ß.√∏sJ"D34√ß.√∏sJ
```
There is a trailing newline.
[Try it online!](http://05ab1e.tryitonline.net/#code=IkQzNMOnLsO4c0oiRDM0w6cuw7hzSgo&input=)
```
"D34√ß.√∏sJ"             Push this string
          D            Duplicate
           34          Push 34 (ASCII for double quote mark)
             √ß         Convert to char
              .√∏       Surround the string with quotes
                s      Swap
                 J     Join. Implicitly display
```
[Answer]
# Clojure, 91 bytes
```
((fn [x] (list x (list (quote quote) x))) (quote (fn [x] (list x (list (quote quote) x)))))
```
[Answer]
# Mathematica, 68 bytes
```
Print[#<>ToString[#,InputForm]]&@"Print[#<>ToString[#,InputForm]]&@"
```
]


[Question]
      []


[Question]
      [
Given an array of any depth, draw its contents with borders of `+-|` around each subarray. Those are the ASCII characters for plus, minus, and vertical pipe.
For example, if the array is `[1, 2, 3]`, draw
```
+-----+
|1 2 3|
+-----+
```
For a nested array such as `[[1, 2, 3], [4, 5], [6, 7, 8]]`, draw
```
+-----------------+
|+-----+---+-----+|
||1 2 3|4 5|6 7 8||
|+-----+---+-----+|
+-----------------+
```
For a ragged array such as `[[[1, 2, 3], [4, 5]], [6, 7, 8]]`, draw
```
+-------------------+
|+-----------+-----+|
||+-----+---+|6 7 8||
|||1 2 3|4 5||     ||
||+-----+---+|     ||
|+-----------+-----+|
+-------------------+
```
Notice that there is more space after drawing `[6, 7, 8]`. You may either draw the contents on the top-most, center, or bottom-most line, but whichever you choose, you must remain consistent.
This challenge was inspired by the [box](http://www.jsoftware.com/help/dictionary/d010.htm) verb `<` from J.
## Rules
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'") so the shortest code wins.
* Builtins that solve this are not allowed.
* The input array will contain only nonnegative integer values or arrays. Each array will be homogenous, meaning that its elements will either by only arrays or only integers, but never a mix of both.
* Each subarray may be nested to any depth.
* The output may either by as a string or as an array of strings where each string is a line of output.
## Test Cases
```
[]
++
||
++
[[], []]
+---+
|+++|
|||||
|+++|
+---+
[[], [1], [], [2], [], [3], []]
+-----------+
|++-++-++-++|
|||1||2||3|||
|++-++-++-++|
+-----------+
[[[[[0]]]]]
+---------+
|+-------+|
||+-----+||
|||+---+|||
||||+-+||||
|||||0|||||
||||+-+||||
|||+---+|||
||+-----+||
|+-------+|
+---------+
[[[[[4, 3, 2, 1]]]], [[[3, 2, 1]]], [[2, 1]], [1]]
+---------------------------------+
|+-------------+---------+-----+-+|
||+-----------+|+-------+|+---+|1||
|||+---------+|||+-----+|||2 1|| ||
||||+-------+|||||3 2 1|||+---+| ||
|||||4 3 2 1|||||+-----+||     | ||
||||+-------+|||+-------+|     | ||
|||+---------+||         |     | ||
||+-----------+|         |     | ||
|+-------------+---------+-----+-+|
+---------------------------------+
```

[Answer]
## JavaScript (ES6), ~~223~~ 203 bytes
```
f=(a,g=a=>a[0].map?`<${a.map(g).join`|`}>`:a.join` `,s=g([a]),r=[s],t=s.replace(/<[ -9|]*>|[ -9]/g,s=>s[1]?s.replace(/./g,c=>c>`9`?`+`:`-`):` `))=>t<`+`?r.join`\n`.replace(/<|>/g,`|`):f(a,g,t,[t,...r,t])
```
Port of @MitchSchwartz's Ruby solution. Previous version which worked by recursively wrapping the arrays (and therefore worked for arbitrary content, not just integers):
```
f=(...a)=>a[0]&&a[0].map?[s=`+${(a=a.map(a=>f(...a))).map(a=>a[0].replace(/./g,`-`)).join`+`}+`,...[...Array(Math.max(...a.map(a=>a.length)))].map((_,i)=>`|${a.map(a=>a[i]||a[0].replace(/./g,` `)).join`|`}|`),s]:[a.join` `]
```
Note: Although I'm using the spread operator in my argument list, to obtain the desired output, provide a single parameter of the original array rather then trying to spread the array; this has the effect of wrapping the output in the desired outer box. Sadly the outer box costs me 18 bytes, and space-separating the integers costs me 8 bytes, otherwise the following alternative visualisation would suffice for 197 bytes:
```
f=a=>a.map?[s=`+${(a=a.map(f)).map(a=>a[0].replace(/./g,`-`)).join`+`}+`,...[...Array(Math.max(0,...a.map(a=>a.length)))].map((_,i)=>`|${a.map(a=>a[i]||a[0].replace(/./g,` `)).join`|`}|`),s]:[``+a]
```
[Answer]
# [Dyalog APL](http://dyalog.com/download-zone.htm), 56 [bytes](http://meta.codegolf.stackexchange.com/a/9429/43319)
Thanks to ngn for helping removing about a third of the bytes.
```
{⍵≡∊⍵:⍉⍪⍉⍕⍵⋄(⊢,⊣/)⊃,/(1⊖('++','|'⍴⍨≢),'-'⍪⍣2↑)¨↓↑↓¨∇¨⍵}⊂
```
### TryAPL
[Define the function](http://tryapl.org/?a=f%u2190%7B%u2375%u2261%u220A%u2375%3A%u2349%u236A%u2349%u2355%u2375%u22C4%28%u22A2%2C%u22A3/%29%u2283%2C/%281%u2296%28%27++%27%2C%27%7C%27%u2374%u2368%u2262%29%2C%27-%27%u236A%u23632%u2191%29%A8%u2193%u2191%u2193%A8%u2207%A8%u2375%7D%u2282&run), then run each test case and compare to the built-in `]Display` utility.

[`[1, 2, 3]`](http://tryapl.org/?a=%5Ddisplay%20a%u21901%202%203%20%u22C4%20f%20a&run)

[`[[1, 2, 3], [4, 5], [6, 7, 8]]`](http://tryapl.org/?a=%5Ddisplay%20a%u2190%281%202%203%29%284%205%29%286%207%208%29%20%u22C4%20f%20a&run)

[`[[[1, 2, 3], [4, 5]], [6, 7, 8]]`](http://tryapl.org/?a=%5Ddisplay%20a%u2190%28%281%202%203%29%284%205%29%29%286%207%208%29%20%u22C4%20f%20a&run)

[`[]`](http://tryapl.org/?a=%5Ddisplay%20%u236C%20%u22C4%20f%u236C&run)

[`[[], []]`](http://tryapl.org/?a=%5Ddisplay%20%u236C%u236C%20%u22C4%20f%u236C%u236C&run)

[`[[], [1], [], [2], [], [3], []]`](http://tryapl.org/?a=%5Ddisplay%20a%u2190%u236C%28%2C1%29%u236C%28%2C2%29%u236C%28%2C3%29%u236C%20%u22C4%20f%20a&run)

[`[[[[[0]]]]]`](http://tryapl.org/?a=%5DDisplay%20a%u2190%u2282%u2282%u2282%u2282%2C0%20%u22C4%20f%20a&run)

[`[[[[[4, 3, 2, 1]]]], [[[3, 2, 1]]], [[2, 1]], [1]]`](http://tryapl.org/?a=%5DDisplay%20a%u2190%28%u2282%u2282%u22824%203%202%201%29%28%u2282%u22823%202%201%29%28%u22822%201%29%28%2C1%29%20%u22C4%20f%20a&run)
# Explanation
Overall, this is an anonymous function `{...}` atop an enclose `⊂`. The latter just adds another level of nesting prompting the former to add an outer frame.
The anonymous function with white-space (`⋄` is the statement separator):
```
{
    ⍵ ≡ ∊⍵: ⍉ ⍪ ⍉ ⍕ ⍵
    (⊢ , ⊣/) ⊃ ,/ (1 ⊖ ('++' , '|' ⍴⍨ ≢) , '-' ⍪⍣2 ↑)¨ ↓ ↑ ↓¨ ∇¨ ⍵
}
```
Here it is again, but with separated utility functions:
```
CloseBox ← ⊢ , ⊣/
CreateVertical ← '++' , '|' ⍴⍨ ≢
AddHorizontals ← 1 ⊖ CreateVertical , '-' ⍪⍣2 ↑
{
    ⍵ ≡ ∊⍵: ⍉ ⍪ ⍉ ⍕ ⍵
    CloseBox ⊃ ,/ AddHorizontals¨ ↓ ↑ ↓¨ ∇¨ ⍵
}
```
Now let me explain each function:
`CloseBox` takes a table and returns the same table, but with the table's first column appended on the right of the table. Thus, given the 1-by-3 table `XYZ`, this function returns the 1-by-4 table `XYZX`, as follows:
 `⊢` the argument (lit. what is on the right)
 `,` prepended to
 `⊣/` the leftmost column (lit. the left-reduction of each row)
`CreateVertical` takes a table and returns the a string consisting of the characters which would fit `|`s on the sides of the table, but with two `+`s prepended to match two rows of `-`. Eventually the table will be cyclically rotated one row to get a single `+---...` row above and below. Thus, given any three row table, this function returns `++|||`, as follows:
 `'++' ,` two pluses prepended to
 `'|' ⍴⍨` a stile reshaped by
 `≢` the (rows') tally of the argument
`AddHorizontals` takes a list-of-lists, makes it into a table, adds two rows of `-`s on top, adds the corresponding left edge characters on the left, then rotates one row to the bottom, so that the table has a border on the top, left, and bottom. As follows:
 `1 ⊖` rotate one row (the top row goes to the bottom) of
 `CreateVertical ,` the string `++|||...` prepended (as a column) to
 `'-' ⍪⍣2` minus added twice to the top of
 `↑` the argument transformed from list-of-lists to table
`{`The anonymous function`}`: If the argument is a simple (not nested) list, make it into a character table (thus, given the 3-element list `1 2 3`, this function returns the visually identical 1-by-five character table `1 2 3`). If the argument is not a simple list, ensure the elements are simple character tables; pad them to equal height; frame each on their top, bottom, and left; combine them; and finally take the very first column and add it on the right. As follows:
 `{` begin the definition of an anonymous function
  `⍵ ≡ ∊⍵:` if the argument is identical to the flattened argument (i.e. it is a simple list), then:
   `⍉` transpose the
   `⍪` columnized
   `⍉` transposed
   `⍕ ⍵` stringified argument; else:
  `CloseBox` Add the leftmost column to the right of
  `⊃ ,/` the disclosed (because reduction encloses) concatenated-across
  `AddHorizontals¨` add `-`s on top and bottom of each of
  `↓ ↑ ↓¨` the padded-to-equal-height\* of
  `∇¨ ⍵`  this anonymous function applied to each of the arguments
 `}` end the definition of the anonymous function
\* Lit. make each table into a list-of-lists, combine the lists-of-lists (padding with empty strings to fill short rows) into a table, then split the table into a list of lists-of-lists
[Answer]
## Brainfuck, 423 bytes
```
->>+>>,[[>+>+<<-]+++++[>--------<-]>[<+>-[[-]<-]]>[[-]<<[>>>>+<<<<<<-<[>-<-]>>>-
]<<<[-<<<<<<-<]>+>>>]<<<[>>+>>>>>+<<<<<<<-]>>>>>>>>>,]<<+[<<,++>[-[>++<,<+[--<<<
<<<<+]>]]<[-<+]->>>>[<++<<[>>>>>>>+<<<<<<<-]>>>-[<++>-[>>>>+<<<<<++<]<[<<]>]<[>>
+<<<<]>>>+>+>[<<<-<]<[<<]>>>>->+>[-[<-<-[-[<]<[<++<<]>]<[<++++<<]>]<[>+<-[.<<<,<
]<[<<]]>]<[-<<<<<]>>[-[<+>---[<<++>>+[--[-[<+++++++<++>>,]]]]]<+++[<+++++++++++>
-]<-.,>>]>>>>+>>>>]<<-]
```
Formatted with some comments:
```
->>+>>,
[
  [>+>+<<-]
  +++++[>--------<-]
  >
  [
    not open paren
    <+>-
    [
      not paren
      [-]<-
    ]
  ]
  >
  [
    paren
    [-]
    <<
    [
      close paren
      >>>>+<<<<
      <<-<[>-<-]>>>
      -
    ]
    <<<
    [
      open paren directly after close paren
      -<<<<<<-<
    ]
    >+>>>
  ]
  <<<[>>+>>>>>+<<<<<<<-]>>>
  >>>>>>,
]
<<+
[
  <<,++>
  [
    -
    [
      >++<
      ,<+[--<<<<<<<+]
      >
    ]
  ]
  <[-<+]
  ->>>>
  [
    <++<<[>>>>>>>+<<<<<<<-]>>>-
    [
      at or before border
      <++>-
      [
        before border
        >>>>+<<<<
        <++<
      ]
      <[<<]
      >
    ]
    <
    [
      after border
      >>+<<
      <<
    ]
    >>>+>+>
    [
      column with digit or space
      <<<-<
    ]
    <[<<]
    >>>>->+>
    [
      middle or bottom
      -
      [
        bottom
        <-<-
        [
          at or before border
          -
          [
            before border
            <
          ]
          <
          [
            at border
            <++<<
          ]
          >
        ]
        <
        [
          after border
          <++++<<
        ]
        >
      ]
      <
      [
        middle
        >+<
        -[.<<<,<]
        <[<<]
      ]
      >
    ]
    <[-<<<<<]
    >>
    [
      border char or space
      -
      [
        not space
        <+>---
        [
          not plus
          <<++>>
          +
          [
            --
            [
              -
              [
                pipe
                <+++++++<++>>,
              ]
            ]
          ]
        ]
      ]
      <+++[<+++++++++++>-]<-.,>>
    ]
    > >>>+>>>>
  ]
  <<-
]
```
[Try it online.](http://brainfuck.tryitonline.net/#code=LT4-Kz4-LFtbPis-Kzw8LV0rKysrK1s-LS0tLS0tLS08LV0-WzwrPi1bWy1dPC1dXT5bWy1dPDxbPj4-Pis8PDw8PDwtPFs-LTwtXT4-Pi1dPDw8Wy08PDw8PDwtPF0-Kz4-Pl08PDxbPj4rPj4-Pj4rPDw8PDw8PC1dPj4-Pj4-Pj4-LF08PCtbPDwsKys-Wy1bPisrPCw8K1stLTw8PDw8PDwrXT5dXTxbLTwrXS0-Pj4-WzwrKzw8Wz4-Pj4-Pj4rPDw8PDw8PC1dPj4-LVs8Kys-LVs-Pj4-Kzw8PDw8Kys8XTxbPDxdPl08Wz4-Kzw8PDxdPj4-Kz4rPls8PDwtPF08Wzw8XT4-Pj4tPis-Wy1bPC08LVstWzxdPFs8Kys8PF0-XTxbPCsrKys8PF0-XTxbPis8LVsuPDw8LDxdPFs8PF1dPl08Wy08PDw8PF0-PlstWzwrPi0tLVs8PCsrPj4rWy0tWy1bPCsrKysrKys8Kys-PixdXV1dXTwrKytbPCsrKysrKysrKysrPi1dPC0uLD4-XT4-Pj4rPj4-Pl08PC1d&input=KCgoKCg0IDMgMiAxKSkpKSgoKDMgMiAxKSkpKCgyIDEpKSgxKSkK)
Expects input formatted like `(((((4 3 2 1))))(((3 2 1)))((2 1))(1))` with a trailing newline, and produces output of the form:
```
+---------------------------------+
|+-------------+---------+-----+-+|
||+-----------+|+-------+|+---+| ||
|||+---------+|||+-----+|||   || ||
||||+-------+|||||     ||||   || ||
|||||4 3 2 1||||||3 2 1||||2 1||1||
||||+-------+|||||     ||||   || ||
|||+---------+|||+-----+|||   || ||
||+-----------+|+-------+|+---+| ||
|+-------------+---------+-----+-+|
+---------------------------------+
```
The basic idea is to calculate which character to print based on the depth of nesting. The output format is such that the row index of a box's top border is equal to the corresponding array's depth, with symmetry across the middle row.
The tape is divided into 7-cell nodes, with each node representing a column in the output.
The first loop consumes the input and initializes the nodes, keeping track of depth and whether the column corresponds to a parenthesis (i.e., whether the column contains a vertical border), and collapsing occurrences of `)(` into single nodes.
The next loop outputs one row per iteration. Within this loop, another loop traverses the nodes and prints one character per iteration; this is where most of the work takes place.
During the initialization loop, the memory layout of a node at the beginning of an iteration is
`x d 0 c 0 0 0`
where `x` is a boolean flag for whether the previous char was a closing parenthesis, `d` is depth (plus one), and `c` is the current character.
During the character printing loop, the memory layout of a node at the beginning of an iteration is
`0 0 d1 d2 c p y`
where `d1` indicates depth compared with row index for top half; `d2` is similar to `d1` but for bottom half; `c` is the input character for that column if digit or space, otherwise zero; `p` indicates phase, i.e. top half, middle, or bottom half; and `y` is a flag that gets propagated from left to right, keeping track of whether we have reached the middle row yet. Note that since `y` becomes zero after processing a node, we can use the `y` cell of the previous node to gain more working space.
This setup allows us to avoid explicitly calculating the max depth during the initialization phase; the `y` flag is back-propagated to update the `p` cells accordingly.
There is a `-1` cell to the left of the nodes to facilitate navigation, and there is a cell to the right of the nodes that keeps track of whether we have printed the last row yet.
[Answer]
# Ruby, 104 bytes
```
->s{r=s=s.gsub'}{',?|
r=[s,r,s]*$/while s=s.tr('!-9',' ').gsub!(/{[ |]*}/){$&.tr' -}','-+'}
r.tr'{}',?|}
```
Anonymous function that expects a string. For example, `{{{{{4 3 2 1}}}}{{{3 2 1}}}{{2 1}}{1}}` produces
```
+---------------------------------+
|+-------------+---------+-----+-+|
||+-----------+|         |     | ||
|||+---------+||+-------+|     | ||
||||+-------+||||+-----+||+---+| ||
|||||4 3 2 1||||||3 2 1||||2 1||1||
||||+-------+||||+-----+||+---+| ||
|||+---------+||+-------+|     | ||
||+-----------+|         |     | ||
|+-------------+---------+-----+-+|
+---------------------------------+
```
You can use this code for testing:
```
f=->s{r=s=s.gsub'}{',?|
r=[s,r,s]*$/while s=s.tr('!-9',' ').gsub!(/{[ |]*}/){$&.tr' -}','-+'}
r.tr'{}',?|}
a=[]
a<<'[1, 2, 3]'
a<<'[[1, 2, 3], [4, 5], [6, 7, 8]]'
a<<'[[[1, 2, 3], [4, 5]], [6, 7, 8]]'
a<<'[]'
a<<'[[], []]'
a<<'[[], [1], [], [2], [], [3], []]'
a<<'[[[[[0]]]]]'
a<<'[[[[[4, 3, 2, 1]]]], [[[3, 2, 1]]], [[2, 1]], [1]]'
a.map{|s|s.gsub! '], [','}{'
s.tr! '[]','{}'
s.gsub! ',',''
puts s
puts f[s],''}
```
This starts from the middle row and works outwards. First, instances of `}{` are replaced with `|`. Then, while there are still braces, all innermost `{...}` strings are transformed into the appropriate `+-` sequences while characters other than `|{}` are turned into spaces. At the end, the intermediate braces are turned into pipes.
[Answer]
# PHP+HTML, not competing (~~170~~ ~~141~~ ~~135~~ 130 bytes)
saved 29 bytes inspired by SteeveDroz
```
<?function p($a){foreach($a as$e)$r.=(is_array($e)?p($e):" $e");return"<b style='border:1px solid;float:left;margin:1px'>$r</b>";}
```
not competing because it´s no ascii output and because I let the browser do all the interesting work
[Answer]
# JavaScript (ES6), 221
A non recursive function returning an array of strings (still using a recursive subfunction inside)
```
a=>[...(R=(a,l)=>a[r[l]='',0]&&a[0].map?'O'+a.map(v=>R(v,l+1))+'C':a.join` `)([a],l=-1,r=[],m='')].map(c=>r=r.map(x=>x+v[(k<0)*2+!k--],k=l,1/c?v='-- ':(v='-+|',c>'C'?k=++l:c>','&&--l,c='|'),m+=c))&&[...r,m,...r.reverse()]
```
This works in 2 steps.
Step 1: recursively build a string representation of the nested input array. Example:
`[[[1, 2, 3], [],[4, 5]], [6, 7, 8]]` -> `"OOO1 2 3,,4 5C,6 7 8CC"`
`O` and `C` mark open and close subarray. Simple numeric subarrays are rendered with the elements separated by space, while if array members are subarrays they are separated by commas. This string keeps track of the multilevel structure of the input array, while I can get the middle row of the output just replacing `OC,` with `|`. While recursively building this temp string, I also find the max depth level and initialize an array of empty strings that will contain the half top part of the output.
Note: the outer box is tricky, I nest the input inside another outer array, then I have drop the first row of output that is not needed
Step 2: scan the temp string and build the output
Now I have an array of empty strings, one for each level. I scan the temp string, keeping track of the current level, that increases for each `O` and decreases for each `C`. I visualize this like that:
```
[[[1, 2, 3], [],[4, 5]], [6, 7, 8]]
OOO1 2 3,,4 5C,6 7 8CC
+                    +
 +            +     +
  +     ++   +
|||1 2 3||4 5||6 7 8||
```
The plus the goes up and down follow the current level
For each char, I add a character to every row of output, following the rules:
- if digit or space, put a '-' at the current level and below, put a space above
- else, put a '+' at the current level, put a '-' if below and put a '|' if above
```
OOO1 2 3,,4 5C,6 7 8CC
+--------------------+
|+------------+-----+|
||+-----++---+|     ||
|||1 2 3||4 5||6 7 8||
```
During the temp scan, I also build the middle row replacing `OC,` with `|`
At the end of this step, I have the top half and the middle row, I only have to mirror the top to get the bottom half and I'm done
*Less golfed, commented code*
```
a=>{
   r = []; // output array
   R = ( // recursive scan function
     a, // current subarray
     l  // current level
   ) => (
     r[l] = '', // element of r at level r, init to ""
     a[0] && a[0].map // check if it is a flat (maybe empty) array or an array of arrays
     ? 'O'+a.map(v=>R(v,l+1))+'C' // mark Open and Close, recurse
     : a.join` ` // just put the elements space separated
   );
   T = R([a],-1)]; // build temp string
   // pass the input nested in another array
   // and start with level -1 , so that the first row of r will not be visible to .map
   // prepare the final output
   m = '' // middle row, built upon the chars in T
   l = -1 // starting level
   [...T].map(c => // scan the temp string
         {
            k = l; // current level
            1/c // check if numeric or space
             ? v = '-- ' // use '-','-',' '
             : (
                 v = '-+|', // use '-','+','|'
                 c > 'C'
                   ? k=++l // if c=='O', increment level and assign to k
                   : c>'A'&&--l, // if c=='C', decrement level (but k is not changed)
                 c='|' // any of O,C,comma must be mapped to '|'
               );
            m += c; // add to middle row
            r = r.map( (x,i) => // update each output row
                       // based on comparation between row index and level
                       // but in golfed code I don't use the i index
                       // and decrement l at each step
                       x + v[(k<i)*2+!(k-i)]
                     )
         })
   // almost done!
   return [...r,m,...r.reverse()]
```
)
**Test**
```
F=
a=>[...(R=(a,l)=>a[r[l]='',0]&&a[0].map?'O'+a.map(v=>R(v,l+1))+'C':a.join` `)([a],l=-1,r=[],m='')].map(c=>r=r.map(x=>x+v[(k<0)*2+!k--],k=l,1/c?v='-- ':(v='-+|',c>'C'?k=++l:c>','&&--l,c='|'),m+=c))&&[...r,m,...r.reverse()]
out=x=>O.textContent = x+'\n'+O.textContent
;[[1,2,3]
,[[[1, 2, 3], [4, 5]], [6, 7, 8]]
,[]
,[[], []]
,[[], [1], [], [2], [], [3], []]
,[[[[[0]]]]]
,[[[[[4, 3, 2, 1]]]], [[[3, 2, 1]]], [[2, 1]], [1]]
].forEach(t=>
  out(JSON.stringify(t)+'\n'+F(t).join`\n`+'\n')
)
function update()
{
  var i=eval(I.value)
  out(JSON.stringify(i)+'\n'+F(i).join`\n`+'\n')
}
update()
```
```
#I { width:90%}
```
```
<input id=I value='[[[1, 2, 3], [],[4, 5]], [6, 7, 8]]' oninput='update()'>
<pre id=O></pre>
```
[Answer]
# Ruby, ~~245~~ 241 bytes
The overhead needed to wrap everything in boxes as well as align everything is pretty heavy...
Outputs arrays of strings, with one string per line, as per the spec. Bottom-aligned instead of the top-aligned sample test cases because it saves 1 byte.
[Try it online!](https://repl.it/EKQz/3)
```
V=->a{a==[*a]?(k=a.map(&V);k[0]==[*k[0]]?[h=?++?-*((k.map!{|z|z[1,0]=[' '*~-z[0].size+?|]*(k.map(&:size).max-z.size);z};f=k.shift.zip(*k).map{|b|?|+b.reduce{|r,e|r+e[1..-1]}+?|})[0].size-2)+?+,*f,h]:[h="+#{?-*(f=k*' ').size}+",?|+f+?|,h]):a}
```
[Answer]
# PHP, 404 Bytes
All solutions works with maximum depth of the array lesser then 10.
for greater values the depth must store in an array and not in a string.
```
<?foreach(str_split(json_encode($_GET[a]))as$j){$j!="]"?:$c--;$r=($j==",")?($l=="]"?"":" "):$j;$r=$r=="]"?"|":$r;$r=$r=="["?($v=="]"?"":"|"):$r;if($r!=""){$n.=$r;$d.=+$c;}$v=$l;$l=$j;$j!="["?:$c++;$m>=$c?:$m=$c;}for($x=0;$x<strlen($n);$x++)for($y=0;$y<$m;$y++)$z[$y].=$y==$d[$x]&&$n[$x]=="|"?"+":($y<$d[$x]?"-":($y>$d[$x]&&$n[$x]=="|"?"|":" "));echo join("\n",$z),"\n$n\n".(join("\n",array_reverse($z)));
```
Expanded
```
foreach(str_split(json_encode($_GET[a]))as$j){ # split JSON representation of the array
    $j!="]"?:$c--;
    $r=($j==",")?($l=="]"?"":" "):$j;
    $r=$r=="]"?"|":$r;
    $r=$r=="["?($v=="]"?"":"|"):$r;
    if($r!=""){
      $n.=$r;  # concanate middle string
      $d.=+$c; # concanate depth position
    }
    $v=$l;
    $l=$j;
    $j!="["?:$c++;
    $m>=$c?:$m=$c; # maximum depth of the array
}
for($x=0;$x<strlen($n);$x++)for($y=0;$y<$m;$y++)
$z[$y].=$y==$d[$x]&&$n[$x]=="|"?"+":($y<$d[$x]?"-":($y>$d[$x]&&$n[$x]=="|"?"|":" "));
# Build the strings before the middle string dependent of value middle string and depth
echo join("\n",$z),"\n$n\n".(join("\n",array_reverse($z))); #Output
```
## for 425 Bytes we can make this with REGEX
```
<?$n=($p=preg_filter)("#\]|\[#","|",$r=$p("#\],\[#","|",$p("#,(\d)#"," $1",json_encode($_GET[a]))));preg_match_all("#.#",$r,$e,256);foreach($e[0] as$f){$f[0]!="]"&&$f[0]!="|"?:$c--;$d.=+$c;$f[0]!="|"&&$f[0]!="["?:$c++;$m>=$c?:$m=$c;}for($x=0;$x<strlen($n);$x++)for($y=0;$y<$m;$y++)$z[$y].=$y==$d[$x]&&$n[$x]=="|"?"+":($y<$d[$x]?"-":($y>$d[$x]&&$n[$x]=="|"?"|":" "));echo join("\n",$z),"\n$n\n".(join("\n",array_reverse($z)));
```
Expanded
```
$r=preg_filter("#\],\[#","|",preg_filter("#,(\d)#"," $1",json_encode($_GET[a])));
preg_match_all("#.#",$r,$e,256);
$n=preg_filter("#\]|\[#","|",$r); # concanate middle string
foreach($e[0] as$f){
    $f[0]!="]"&&$f[0]!="|"?:$c--;
    $d.=+$c; concanate depth position
    $f[0]!="|"&&$f[0]!="["?:$c++;
    $m>=$c?:$m=$c; # maximum depth of the array
}
# similar to the other ways
for($x=0;$x<strlen($n);$x++)
for($y=0;$y<$m;$y++)
$z[$y].=$y==$d[$x]&&$n[$x]=="|"?"+":($y<$d[$x]?"-":($y>$d[$x]&&$n[$x]=="|"?"|":" "));
echo join("\n",$z),"\n$n\n".(join("\n",array_reverse($z)));
```
## 455 Bytes for a recursive solution
```
<?function v($x,$t=0,$l=1){global$d;$d.=$t;$s="|";$c=count($x);foreach($x as$k=>$v){if(is_array($v))$e=v($v,$t+1,$k+1==$c);else{$e=$v." "[$k+1==$c];$d.=str_pad("",strlen($e),$t+1);}$s.=$e;}$d.=$l?$t:"";$s.=$l?"|":"";return$s;}$n=v($_GET[a]);$m=max(str_split($d));for($x=0;$x<strlen($n);$x++)for($y=0;$y<$m;$y++)$z[$y].=$y==$d[$x]&&$n[$x]=="|"?"+":($y<$d[$x]?"-":($y>$d[$x]&&$n[$x]=="|"?"|":" "));echo join("\n",$z),"\n$n\n".(join("\n",array_reverse($z)));
```
Expanded
```
function v($x,$t=0,$l=1){
    global$d; # concanate depth position
    $d.=$t;
    $s="|";
    $c=count($x);
    foreach($x as$k=>$v){
        if(is_array($v)){$e=v($v,$t+1,$k+1==$c);}
        else{$e=$v." "[$k+1==$c];$d.=str_pad("",strlen($e),$t+1);}
        $s.=$e;
    }
    $d.=$l?$t:"";
    $s.=$l?"|":"";
    return$s;
}
$n=v($_GET[a]); # concanate middle string
$m=max(str_split($d)); # maximum depth of the array
# similar to the other ways
for($x=0;$x<strlen($n);$x++)
for($y=0;$y<$m;$y++)
$z[$y].=$y==$d[$x]&&$n[$x]=="|"?"+":($y<$d[$x]?"-":($y>$d[$x]&&$n[$x]=="|"?"|":" "));
echo join("\n",$z),"\n$n\n".(join("\n",array_reverse($z)));
```
]


[Question]
      [
# ...counted!
You will pass your program a variable which represents a quantity of money in dollars and/or cents and an array of coin values. Your challenge is to output the number of possible combinations of the given array of coin values that would add up to the amount passed to the code. If it is not possible with the coins named, the program should return `0`.
Note on American numismatic terminology:
* 1-cent coin: penny
* 5-cent coin: nickel
* 10-cent coin: dime
* 25-cent coin: quarter (quarter dollar)
**Example 1:**
Program is passed:
```
12, [1, 5, 10]
```
(12 cents)
Output:
```
4
```
There are 4 possible ways of combining the coins named to produce 12 cents:
1. 12 pennies
2. 1 nickel and 7 pennies
3. 2 nickels and 2 pennies
4. 1 dime and 2 pennies
**Example 2:**
Program is passed:
```
26, [1, 5, 10, 25]
```
(26 cents)
Output:
```
13
```
There are 13 possible ways of combining the coins named to produce 26 cents:
1. 26 pennies
2. 21 pennies and 1 nickel
3. 16 pennies and 2 nickels
4. 11 pennies and 3 nickels
5. 6 pennies and 4 nickels
6. 1 penny and 5 nickels
7. 16 pennies and 1 dime
8. 6 pennies and 2 dimes
9. 11 pennies, 1 dime, and 1 nickel
10. 6 pennies, 1 dime, and 2 nickels
11. 1 penny, 1 dime, and 3 nickels
12. 1 penny, 2 dimes, and 1 nickel
13. 1 quarter and 1 penny
**Example 3:**
Program is passed:
```
19, [2, 7, 12]
```
Output:
```
2
```
There are 2 possible ways of combining the coins named to produce 19 cents:
1. 1 12-cent coin and 1 7-cent coin
2. 1 7-cent coin and 6 2-cent coins
**Example 4:**
Program is passed:
```
13, [2, 8, 25]
```
Output:
```
0
```
There are no possible ways of combining the coins named to produce 13 cents.
---
This has been through the Sandbox. Standard loopholes apply. This is code golf, so the answer with the fewest bytes wins.

[Answer]
## Haskell, ~~37~~ 34 bytes
```
s#l@(c:d)|s>=c=(s-c)#l+s#d
s#_=0^s
```
Usage example: `26 # [1,5,10,25]` -> `13`.
Simple recursive approach: try both the next number in the list (as long as it is less or equal to the amount) and skip it. If subtracting the number leads to an amount of zero, take a `1` else (or if the list runs out of elements) take a `0`. Sum those `1`s and `0`s.
Edit: @Damien: saved 3 bytes by pointing to a shorter base case for the recursion (which also can be found in [@xnors answer](https://codegolf.stackexchange.com/a/96900/34531)).
[Answer]
## Mathematica, ~~35~~ 22 bytes
*Thanks to miles for suggesting `FrobeniusSolve` and saving 13 bytes.*
```
Length@*FrobeniusSolve
```
Evaluates to an unnamed function, which takes the list of coins as the first argument and the target value as the second. `FrobeniusSolve` is a shorthand for solving Diophantine equations of the form
```
a1x1 + a2x2 + ... + anxn = b
```
for the `xi` over the non-negative integers and gives us all the solutions.
[Answer]
# Jelly ([fork](https://github.com/miles-cg/jelly/tree/frobenius)), 2 bytes
```
æf
```
This relies on a [branch](https://github.com/miles-cg/jelly/tree/frobenius) of Jelly where I was working on implementing Frobenius solve atoms so unfortunately you cannot try it online.
## Usage
```
$ ./jelly eun 'æf' '12' '[1,5,10]'
4
$ ./jelly eun 'æf' '26' '[1,5,10,25]'
13
$ ./jelly eun 'æf' '19' '[2,7,12]'
2
$ ./jelly eun 'æf' '13' '[2,8,25]'
0
```
## Explanation
```
æf  Input: total T, denominations D
æf  Frobenius count, determines the number of solutions
    of nonnegative X such that X dot-product D = T
```
[Answer]
# Pyth, 8 bytes
```
/sM{yS*E
```
Raw brute force, too memory intensive for actual testing. This is O(2*mn*), where *n* is the number of coins and *m* is the target sum. Takes input as `target\n[c,o,i,n,s]`.
```
/sM{yS*EQQ      (implicit Q's)
      *EQ       multiply coin list by target
     S          sort
    y           powerset (all subsequences)
   {            remove duplicates
 sM             sum all results
/        Q      count correct sums
```
[Answer]
## Haskell, 37 bytes
```
s%(h:t)=sum$map(%t)[s,s-h..0]
s%_=0^s
```
Using some multiple of the first coin `h` decreases the required sum `s` to a non-negative value in the decreasing progression `[s,s-h..0]`, which then must be made with the remaining coins. Once there's no coins left, check that the sum is zero arithmetically as `0^s`.
[Answer]
## JavaScript (ES6), ~~51~~ 48 bytes
```
f=(n,a,[c,...b]=a)=>n?n>0&&c?f(n-c,a)+f(n,b):0:1
```
Accepts coins in any order. Tries both using and not using the first coin, recursively calculating the number of combinations either way. `n==0` means a matching combination, `n<0` means that the coins exceed the quantity while `c==undefined` means that there are no coins left. Note that the function is very slow and if you have a penny coin then the following function is faster (don't pass the penny coin in the array of coins):
```
f=(n,a,[c,...b]=a)=>c?(c<=n&&f(n-c,a))+f(n,b):1
```
[Answer]
## Perl, 45 bytes
Byte count includes 44 bytes of code and `-p` flag.
```
s%\S+%(1{$&})*%g,(1x<>)=~/^$_$(?{$\++})^/x}{
```
Takes the coin values on the first line, and the targeted amount on the second line :
```
$ perl -pE 's%\S+%(1{$&})*%g,(1x<>)=~/^$_$(?{$\++})^/x}{' <<< "1 5 10 25
26"
13
```
**Short explanations:**
```
-p                        # Set $_ to the value of the input,
                          # and adds a print at the end of the code.
s%\S+%(1{$&})*%g,         # Converts each number n to (1{$&})* (to prepare the regex)
                          # This pattern does half the job.
(1x<>)                    # Converts the target to unary representation.
  =~                      # Match against.. (regex)
    /^ $_ $               # $_ contains the pattern we prepared with the first line.
     (?{$\++})            # Count the number of successful matches
     ^                    # Forces a fail in the regex since the begining can't be matched here.
    /x                    # Ignore white-spaces in the regex
                          # (needed since the available coins are space-separated)
 }{                       # End the code block to avoid the input being printed (because of -p flag)
                          # The print will still be executed, but $_ will be empty,
                          # and only $\ will be printed (this variable is added after every print)
```
[Answer]
# [Jelly](http://github.com/DennisMitchell/jelly), ~~10~~ 9 [bytes](https://github.com/DennisMitchell/jelly/wiki/Code-page)
```
œċÐ€S€€Fċ
```
**[Try it online!](http://jelly.tryitonline.net/#code=xZPEi8OQ4oKsU-KCrOKCrEbEiw&input=U3VtX3tqPTAuLmt9ICgtMSleaiAqIChrLWopXm4gKiBiaW5vbWlhbChuKzEsIGopLg&args=WzEsNSwxMCwyNV0+MjY)**
### How?
```
œċÐ€S€€Fċ - Main link: coins, target
  Ð€      - map over right argument, or for each n in [1,2,...,target]
œċ        - combinations with replacement, possible choices of each of n coins
    S€€   - sum for each for each (values of those selections)
       F  - flatten into one list
        ċ - count occurrences of right argument
```
[Answer]
# JavaScript (ES6), 59 bytes
```
f=(n,c)=>n?c.reduce((x,y,i)=>y>n?x:x+f(n-y,c.slice(i)),0):1
```
Coins are input from highest to lowest, e.g. `f(26,[100,25,10,5,1])`. If you have a penny, remove it and use this much faster version instead:
```
f=(n,c)=>n?c.reduce((x,y,i)=>y>n?x:x+f(n-y,c.slice(i)),1):1
```
This uses a recursive formula much like @nimi's. I originally wrote this a few days ago when the challenge was still in the sandbox; it looked like this:
```
f=(n,c=[100,25,10,5])=>n?c.reduce((x,y,i)=>y>n?x:x+f(n-y,c.slice(i)),1):1
```
The only differences being the default value of `c` (it had a set value in the original challenge), and changing the `0` in the `.reduce` function to `1` (this was two bytes shorter and a bazillion times faster than `c=[100,25,10,5,1]`).
---
Here's a modified version which outputs all combinations, rather than the number of combinations:
```
f=(n,c)=>n?c.reduce((x,y,i)=>y>n?x:[...x,...f(n-y,c.slice(i)).map(c=>[...c,y])],[]):[[]]
```
[Answer]
# PHP, 327 Bytes
```
function c($f,$z=0){global$p,$d;if($z){foreach($p as$m){for($j=0;$j<=$f/$d[$z];){$n=$m;$n[$d[$z]]=$j++;$p[]=$n;}}}else for($p=[],$j=0;$j<=$f/$d[$z];$j++)$p[]=[$d[$z]=>$j];if($d[++$z])c($f,$z);}$d=$_GET[a];c($e=$_GET[b]);foreach($p as$u){$s=0;foreach($u as$k=>$v)$s+=$v*$k;if($s==$e&count($u)==count($d))$t[]=$u;}echo count($t);
```
[Try it](http://sandbox.onlinephpfunctions.com/code/9f0d8ad9a8c645219cb9ec9cd6685b7a55e4ebda)
[Answer]
## Axiom, ~~63~~ 62 bytes
1 byte saved by @JonathanAllan
```
f(n,l)==coefficient(series(reduce(*,[1/(1-x^i)for i in l])),n)
```
This approach uses generating functions. Probably that didn't help bring down the code size. I think this is the first time that in my playing with Axiom I went as far as defining my own function.
The first time the function is called it gives a horrendous warning, but still produces the correct result. After that, everything is fine as long as the list isn't empty.
[Answer]
# R, ~~81~~ ~~76~~ 63 bytes
Thanks to @rturnbull for golfing away 13 bytes!
```
function(u,v)sum(t(t(expand.grid(lapply(u/v,seq,f=0))))%*%v==u)
```
Example (note that `c(...)` is how you pass vectors of values to R):
```
f(12,c(1,5,10))
[1] 4
```
Explanation:
`u` is the desired value, `v` is the vector of coin values.
```
expand.grid(lapply(u/v,seq,from=0))
```
creates a data frame with every possible combination of 0 to k coins (k depends on the denomination), where k is the lowest such that k times the value of that coin is at least u (the value to achieve).
Normally we would use `as.matrix` to turns that into a matrix, but that is many characters. Instead we take the transpose of the transpose (!) which automatically coerces it, but takes fewer characters.
`%*% v` then calculates the monetary value of each row. The last step is to count how many of those values are equal to the desired value `u`.
Note that the computational complexity and memory requirements of this are horrific but hey, it's code golf.
[Answer]
# J, 27 bytes
```
1#.[=](+/ .*~]#:,@i.)1+<.@%
```
## Usage
```
   f =: 1#.[=](+/ .*~]#:,@i.)1+<.@%
   12 f 1 5 10
4
   26 f 1 5 10 25
13
   19 f 2 7 12
2
   13 f 2 8 25
0
```
## Explanation
```
1#.[=](+/ .*~]#:,@i.)1+<.@%  Input: target T (LHS), denominations D (RHS)
                          %  Divide T by each in D
                       <.@   Floor each
                             These are the maximum number of each denomination
                     1+      Add 1 to each, call these B
                ,@i.         Forms the range 0 the the product of B
             ]               Get B
              #:             Convert each in the range to mixed radix B
     ]                       Get D
       +/ .*~                Dot product between D and each mixed radix number
                             These are all combinations of denominations up to T
   [                         Get T
    =                        Test if each sum is equal to T
1#.                          Convert as base 1 digits to decimal (takes the sum)
                             This is the number of times each sum was true
```
[Answer]
# TSQL, 105 bytes
This can only handle up to one dollar with these 4 coin types. The ungolfed version can handle up to around 4 dollars, but very slow - on my box this takes 27 seconds. Result is 10045 combinations b.t.w.
Golfed:
```
DECLARE @ INT = 100
DECLARE @t table(z int)
INSERT @t values(1),(5),(10),(25)
;WITH c as(SELECT 0l,0s UNION ALL SELECT z,s+z FROM c,@t WHERE l<=z and s<@)SELECT SUM(1)FROM c WHERE s=@
```
Ungolfed:
```
-- input variables
DECLARE @ INT = 100
DECLARE @t table(z int)
INSERT @t values(1),(5),(10),(25)
-- query
;WITH c as
(
  SELECT 0l,0s
  UNION ALL
  SELECT z,s+z
  FROM c,@t
  WHERE l<=z and s<@
)
SELECT SUM(1)
FROM c
WHERE s=@
-- to allow more than 100 recursions(amounts higher than 1 dollar in this example)
OPTION(MAXRECURSION 0)
```
**[Fiddle](https://data.stackexchange.com/stackoverflow/query/560877/a-penny-saved-is-a-penny)**
[Answer]
## [tinylisp](https://github.com/dloscutoff/Esolangs/tree/master/tinylisp) repl, 66 bytes
```
(d C(q((Q V)(i Q(i(l Q 0)0(i V(s(C(s Q(h V))V)(s 0(C Q(t V))))0))1
```
Recursive solution: tries using the first coin and not using the first coin, then adds the results from each. Exponential time complexity and no tail-recursion, but it computes the test cases just fine.
Ungolfed (key to builtins: `d` = define, `q` = quote, `i` = if, `l` = less-than, `s` = subtract, `h` = head, `t` = tail):
```
(d combos
 (q
  ((amount coin-values)
   (i amount
    (i (l amount 0)
     0
     (i coin-values
      (s
       (combos
        (s amount (h coin-values))
        coin-values)
       (s
        0
        (combos
         amount
         (t coin-values))))
      0))
    1))))
```
Example usage:
```
tl> (d C(q((Q V)(i Q(i(l Q 0)0(i V(s(C(s Q(h V))V)(s 0(C Q(t V))))0))1
C
tl> (C 12 (q (1 5 10)))
4
tl> (C 26 (q (1 5 10 25)))
13
tl> (C 19 (q (2 7 12)))
2
tl> (C 13 (q (2 8 25)))
0
tl> (C 400 (q (1 5 10 25)))
Error: recursion depth exceeded. How could you forget to use tail calls?!
```
[Answer]
# PHP, 130 bytes
```
function r($n,$a){if($c=$a[0])for(;0<$n;$n-=$c)$o+=r($n,array_slice($a,1));return$o?:$n==0;}echo r($argv[1],array_slice($argv,2));
```
99 byte recursive function (and 31 bytes of calling it) that repeatedly removes the value of the current coin from the target and calls itself with the new value and the other coins. Counts the number of times the target reaches 0 exactly. Run like:
```
 php -r "function r($n,$a){if($c=$a[0])for(;0<$n;$n-=$c)$o+=r($n,array_slice($a,1));return$o?:$n==0;}echo r($argv[1],array_slice($argv,2));" 12 1 5 10
```
[Answer]
## Racket 275 bytes
```
(set! l(flatten(for/list((i l))(for/list((j(floor(/ s i))))i))))(define oll'())(for((i(range 1(add1(floor(/ s(apply min l)))))))
(define ol(combinations l i))(for((j ol))(set! j(sort j >))(when(and(= s(apply + j))(not(ormap(λ(x)(equal? x j))oll)))(set! oll(cons j oll)))))oll
```
Ungolfed:
```
(define(f s l)
  (set! l              ; have list contain all possible coins that can be used
        (flatten
         (for/list ((i l))
           (for/list ((j
                       (floor
                        (/ s i))))
             i))))
  (define oll '())                    ; final list of all solutions initialized
  (for ((i (range 1
                  (add1
                   (floor             ; for different sizes of coin-set
                    (/ s
                       (apply min l)))))))
    (define ol (combinations l i))          ; get a list of all combinations
    (for ((j ol))                           ; test each combination
      (set! j (sort j >))
      (when (and
             (= s (apply + j))              ; sum is correct
             (not(ormap                     ; solution is not already in list
                  (lambda(x)
                    (equal? x j))
                  oll)))
        (set! oll (cons j oll))             ; add found solution to final list
        )))
  (reverse oll))
```
Testing:
```
(f 4 '[1 2])
(println "-------------")
(f 12 '[1 5 10])
(println "-------------")
(f 19 '[2 7 12])
(println "-------------")
(f 8 '(1 2 3))
```
Output:
```
'((2 2) (2 1 1) (1 1 1 1))
"-------------"
'((10 1 1) (5 5 1 1) (5 1 1 1 1 1 1 1) (1 1 1 1 1 1 1 1 1 1 1 1))
"-------------"
'((12 7) (7 2 2 2 2 2 2))
"-------------"
'((3 3 2) (2 2 2 2) (3 2 2 1) (3 3 1 1) (2 2 2 1 1) (3 2 1 1 1) (2 2 1 1 1 1) (3 1 1 1 1 1) (2 1 1 1 1 1 1) (1 1 1 1 1 1 1 1))
```
Following recursive solution has some error:
```
(define (f s l)                      ; s is sum needed; l is list of coin-types
  (set! l (sort l >))
  (define oll '())                   ; list of all solution lists
  (let loop ((l l)
             (ol '()))               ; a solution list initialized
    (when (not (null? l))
        (set! ol (cons (first l) ol)))
    (define ols (apply + ol))        ; current sum in solution list
    (cond
      [(null? l) (remove-duplicates oll)]
      [(= ols s) (set! oll (cons ol oll))
                 (loop (rest l) '())
                 ]
      [(> ols s) (loop (rest l) (rest ol))
                 (loop (rest l) '())
                 ]
      [(< ols s) (loop l ol)
                 (loop (rest l) ol)
                 ])))
```
Does not work properly for:
```
(f 8 '[1 2 3])
```
Output:
```
'((1 1 1 2 3) (1 2 2 3) (1 1 1 1 1 1 1 1) (2 3 3) (1 1 1 1 1 1 2) (1 1 1 1 2 2) (1 1 2 2 2) (2 2 2 2))
```
(1 1 3 3) is possible but does not come in solution list.
[Answer]
# [Jelly](http://github.com/DennisMitchell/jelly), 15 bytes
```
s+\Fṁḷ
2*BW;ç/Ṫ
```
[Try it online!](http://jelly.tryitonline.net/#code=cytcRuG5geG4twoyKkJXO8OnL-G5qg&input=&args=MjY+MSw1LDEwLDI1&debug=on) or [Verify all test cases.](http://jelly.tryitonline.net/#code=cytcRuG5geG4twoyKkJXO8OnL-G5qgrDpyI&input=&args=MTIsMjYsMTksMTM+WzEsNSwxMF0sWzEsNSwxMCwyNV0sWzIsNywxMl0sWzIsOCwyNV0&debug=on)
This was more of an exercise in writing an efficient version in Jelly without using builtins. This is based on the typical dynamic programming approach used to calculate the number of ways for making change
## Explanation
```
s+\Fṁḷ  Helper link. Input: solutions S, coin C
s       Slice the solutions into non-overlapping sublists of length C
 +\     Cumulative sum
   F    Flatten
     ḷ  Left, get S
    ṁ   Mold the sums to the shape of S
2*BW;ç/Ṫ  Main link. Input: target T, denominations D
2*        Compute 2^T
  B       Convert to binary, creates a list with 1 followed by T-1 0's
          These are the number of solutions for each value from 0 to T
          starting with no coins used
   W      Wrap it inside another array
    ;     Concatenate with D
     ç/   Reduce using the helper link
       Ṫ  Tail, return the last value which is the solution
```
[Answer]
# [Actually](http://github.com/Mego/Seriously), 15 bytes
Golfing suggestions welcome. [Try it online!](http://actually.tryitonline.net/#code=4pWXO1Jg4pWc4oiZ4pmCU-KVlOKZgs6jaWBNYw&input=MTAKWzEsNSwxMF0)
```
╗;R`╜∙♂S╔♂Σi`Mc
```
**Ungolfing**
```
         Implicit input n, then the list of coins a.
╗        Save a to register 0.
;R       Duplicate n and create a range [1..n] from that duplicate.
`...`M   Map the following function over that range. Variable i.
  ╜        Push a from register 0.
  ∙        Push the i-th Cartesian power of a.
  ♂S       Sort each member of car_pow.
  ╔        Uniquify car_pow so we don't count too any duplicate coin arrangements.
  ♂Σ       Take the sum of each coin arrangement.
  i        Flatten the list.
c        Using the result of the map and the remaining n, push map.count(n).
         Implicit return.
```
[Answer]
# Python, 120 bytes
```
from itertools import*
lambda t,L:[sum(map(lambda x,y:x*y,C,L))-t for C in product(range(t+1),repeat=len(L))].count(0)
```
Bruteforces through all combinations of coins up to target value (even if the smallest is not 1).
]