问:
The longest period iterating quine
As we know, a quine is a program that outputs its own source code. However, it's also possible to write a program that outputs another, different program, that outputs the first program again. For example, the Python 2 program

```<code>x = '''x = {}
print 'print '+'"'*3+x.format("'"*3+x+"'"*3)+'"'*3'''
print 'print '+'"'*3+x.format("'"*3+x+"'"*3)+'"'*3
</code>```

will, when run, output the following text:

```<code>print """x = '''x = {}
print 'print '+'"'*3+x.format("'"*3+x+"'"*3)+'"'*3'''
print 'print '+'"'*3+x.format("'"*3+x+"'"*3)+'"'*3"""
</code>```

When run as a Python program, this will output the original code again. This is called an iterating quine. Because you have to run it twice to get the original code back, we say it has period 2. But of course, much higher periods are possible.

Your challenge is to write an iterating quine with as long a period as you can, in 100 bytes or less, in the language of your choice. (Note that my example above doesn't fit this spec, as it's 119 bytes, including the trailing newline.)

Please note the following rules and clarifications:

The usual quine rules apply, i.e. your program can't use language features that would let it access its own source code directly.

The iterated outputs have to eventually loop back to exactly your original code, and you have to include a demonstration or proof that it will.

You must also include an explanation of why the cycle is as long as you say it is. This doesn't have to be at the level of a mathematical proof, but it should be convincing to someone familiar with your language. (This rule is here because I expect some of the answers to involve very, very large numbers.)

It's fine to say something like "at least 1,000,000 iterations" rather than giving the exact number, as long as you can prove that it is at least that long. In this case, your score would be 1,000,000. Otherwise, your score is the period of your quine.

The 100 byte limit only applies to your initial program - the programs it outputs can be longer, though of course they'll eventually have to get back down to 100 bytes in order to output your original code.

You can assume your machine has infinite RAM and infinite runtime, but you can't assume unlimited precision data types (such as integers) if your language doesn't have them. You can assume there is no limit to the length of input your parser can handle.

The highest score wins.

Please note: there is an existing challenge called Quit Whining; Start Quining that also involves iterating quines. However, aside from being based on the same concept, these are completely different types of challenge. The other one is straight up code golf, whereas this one is (intentionally!) really a busy beaver problem in disguise. The techniques needed to produce a good answer to this question are likely to be very different from what's needed to answer the other question, and this is very much by design.

Title: The longest period iterating quine

Body:
JavaScript, period 9,007,199,254,700,000

Not going to win, but it was fun working with JavaScript on this challenge:

a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),1-1||90071992547e5)

Follows the following cycle:

a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),1-1||90071992547e5)
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),9007199254700000-1||90071992547e5)
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),9007199254699999-1||90071992547e5)
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),9007199254699998-1||90071992547e5)
// etc...
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),3-1||90071992547e5)
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),2-1||90071992547e5)
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),1-1||90071992547e5)
a="a=%s;console.log(a,uneval(a),%.0f-1||90071992547e5)";console.log(a,uneval(a),9007199254700000-1||90071992547e5)
// and so on

Note: You can make it 18 bytes shorter, while only removing only ~0.08% of the score, like so:

a="a=%s;console.log(a,uneval(a),%.0f-1||9e15)";console.log(a,uneval(a),1-1||9e15)


问:
All Binary Combinations to Decimal
Disclaimer

This question is not a duplicate of this question. I'm not counting specific digits, as we already have those set in the initial parameters. This question is focusing on the decimal numbers that can be constructed from the binary strings based on the digits provided.

Challenge

Given two integers X and Y, representing the number of zeroes (0) and ones (1) respectively, calculate all the possible decimal equivalents that can be determined from creating binary strings using only the zeroes and ones provided, and display them as output.

Example 1:

Input: 0 1

Output: 1

Explanation: Only one 1 to account for, which can only be converted one way.

Example 2:

Input: 1 1

Output: 1,2

Explanation: 01 converts to 1, 10 converts to 2.

Example 3:

Input: 3 2

Output: 3,5,6,9,10,12,17,18,20,24

Explanation: Three 0s and two 1s make 00011 (3), 00101 (5), 00110 (6), 01001 (9), 01010 (10), 01100 (12), 10001 (17), 10010 (18), 10100 (20), 11000 (24)

Limitations and Rules

I will only expect your code to work where 0 < X + Y <= 16 so the maximum number in the output could only occur from 16 1s, i.e. parameters 0 and 16.

As a result of the above limitation, the range of numbers we'd expect in the output are from 0 and 65535.

I will accept functions or code, so long as the resulting output is provided, whether this be a comma separated list, an array, list outputted to STDOUT, etc. The only criteria I must stress about the output is that it must be sorted.

This is code golf, minimum bytes will receive maximum glory.

We will not tolerate silly loopholes

答:
Japt, 16 bytes

```<code>'0pU +'1pV)á mn2
</code>```

Test it online!

How it works

```<code>                  // Implicit: U = first integer, V = second integer
'0pU              // Repeat the string "0" U times.
     +'1pV)       // Concatenate with the string "1" repeated V times.
           á      // Take all unique permutations.
             mn2  // Interpret each item in the resulting array as a binary number.
                  // Implicit: output last expression
</code>```

Alternate version, 17 bytes

```<code>2pU+V o f_¤è'1 ¥V
                   // Implicit: U = first integer, V = second integer
2pU+V              // Take 2 to the power of U + V.
      o            // Create the range [0, 2^(U+V)).
        f_         // Filter to only items where
           è'1     //  the number of "1"s in
          ¤        //  its binary representation
               ¥V  //  is equal to V.
                   // Implicit: output last expression
</code>```

I've been trying to further golf both versions, but I just can't find any slack...

ContentLicense: CC BY-SA 3.0

Title: All Binary Combinations to Decimal

Body:
Japt, 16 bytes

'0pU +'1pV)á mn2

Test it online!

How it works

                  // Implicit: U = first integer, V = second integer
'0pU              // Repeat the string "0" U times.
     +'1pV)       // Concatenate with the string "1" repeated V times.
           á      // Take all unique permutations.
             mn2  // Interpret each item in the resulting array as a binary number.
                  // Implicit: output last expression

Alternate version, 17 bytes

2pU+V o f_¤è'1 ¥V
                   // Implicit: U = first integer, V = second integer
2pU+V              // Take 2 to the power of U + V.
      o            // Create the range [0, 2^(U+V)).
        f_         // Filter to only items where
           è'1     //  the number of "1"s in
          ¤        //  its binary representation
               ¥V  //  is equal to V.
                   // Implicit: output last expression

I've been trying to further golf both versions, but I just can't find any slack...


问:
Golf you a quine for great good!
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='
'+c.body.replace(OVERRIDE_REG,'')+'
'});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(''+a.language+'').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)}}```
<pre class="snippet-code-css lang-css prettyprint-override"><code>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}</code>```

  <link rel="stylesheet" type="text/css" href="https://cdn.sstatic.net/Sites/codegolf/primary.css?v=f52df912b654">

Winners by Language

Language	User	Score

Leaderboard

	Author	Language	Size

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}

{{LANGUAGE}}	{{NAME}}	{{SIZE}}

 ```

答:
Julia, 36 bytes

(~=:@printf "(~=:%s)|>eval" ~)|>eval
```

Try it online!

Background

Unlike many other languages, Julia's eval doesn't work as expected with a string; for example, eval("print(42)") just returns the string print(42).

To actually executed print(42) with eval;, we have to pass an Expr to eval. This can be done by invoking parse on a string (e.g., eval(parse("print(42)"))) or by passing an Expr literal to eval (e.g., eval(:(print(42))).

Now, while : is a unary operator and :print works fine on its own, :print(42) does not, as it is parsed as (:print)(42), making all parentheses in :(print(42)) mandatory.

However, if we use the macro @printf instead, the parsing rules change, and :@printf(42) works as intended. Also, macro calls also do not require parentheses, and :@printf 42 saves one byte over :(print(42)).

How it works

:@printf "(~=:%s)|>eval" ~ constructs the Expr that calls @printf with the specified format string and additional argument ~. Here, ~ is simply a variable reference; the name is arbitrary.

~=<Expr> saves the generated Expr in the variable ~, which will be accessible when the Expr is evaluated.

Finally, (<assigment>)|>eval calls eval with the return value of the assignment, i.e., the Expr that was assigned to ~.

ContentLicense: CC BY-SA 4.0

Title: Golf you a quine for great good!

Body:
Julia, 36 bytes

(~=:@printf "(~=:%s)|>eval" ~)|>eval

Try it online!

Background

Unlike many other languages, Julia's eval doesn't work as expected with a string; for example, eval("print(42)") just returns the string print(42).

To actually executed print(42) with eval;, we have to pass an Expr to eval. This can be done by invoking parse on a string (e.g., eval(parse("print(42)"))) or by passing an Expr literal to eval (e.g., eval(:(print(42))).

Now, while : is a unary operator and :print works fine on its own, :print(42) does not, as it is parsed as (:print)(42), making all parentheses in :(print(42)) mandatory.

However, if we use the macro @printf instead, the parsing rules change, and :@printf(42) works as intended. Also, macro calls also do not require parentheses, and :@printf 42 saves one byte over :(print(42)).

How it works

:@printf "(~=:%s)|>eval" ~ constructs the Expr that calls @printf with the specified format string and additional argument ~. Here, ~ is simply a variable reference; the name is arbitrary.

~=<Expr> saves the generated Expr in the variable ~, which will be accessible when the Expr is evaluated.

Finally, (<assigment>)|>eval calls eval with the return value of the assignment, i.e., the Expr that was assigned to ~.


问:
Showcase of Languages

Notes

This thread is open and unlocked only because the community decided to make an exception. Please do not use this question as evidence that you can ask similar questions here. Please do not create additional showcase questions.

This is no longer a popularity-contest, nor are snippet lengths limited by the vote tally. If you know this thread from before, please make sure you familiarize yourself with the changes.

This thread is dedicated to showing off interesting, useful, obscure, and/or unique features your favorite programming languages have to offer. This is neither a challenge nor a competition, but a collaboration effort to showcase as many programming languages as possible as well as possible.

How this works

All answers should include the name of the programming language at the top of the post, prefixed by a #.

Answers may contain one (and only one) factoid, i.e., a couple of sentences without code that describe the language.

Aside from the factoid, answers should consist of snippets of code, which can (but don't have to be) programs or functions.

The snippets do not need to be related. In fact, snippets that are too related may be redundant.

Since this is not a contest, all programming languages are welcome, whenever they were created.

Answers that contain more than a handful of code snippets should use a Stack Snippet to collapse everything except the factoid and one of the snippets.

Whenever possible, there should be only one answer per programming language. This is a community wiki, so feel free to add snippets to any answer, even if you haven't created it yourself. There is a Stack Snippet for compressing posts, which should mitigate the effect of the 30,000 character limit.

Answers that predate these guidelines should be edited. Please help updating them as needed.

Current answers, sorted alphabetically by language name

$.ajax({type:"GET",url:"https://api.stackexchange.com/2.2/questions/44680/answers?site=codegolf&filter=withbody",success:function(data){for(var i=0;i<data.items.length;i++){var temp=document.createElement('p');temp.innerHTML = data.items[i].body.split("\n")[0];$('#list').append('
' + temp.innerText || temp.textContent + '');}}})```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><base href="http://codegolf.stackexchange.com"><ul id="list"></ul></code>```

答:
Cubix

Click on any snippet's header to try it in the online interpreter!

For reference, the text in bold tells you the important stuff.

Factoid

Cubix is a stack-based language, created by me, which runs like a 2D language such as Befunge. The main difference? The code is run on the outside of a cube.

Length 1

```<code>@
</code>```

This is pretty much the character most commonly used. Why? Because it immediately ends execution of the program. In fact, it's the only way to end the program.

This is useless as a program, though, because it gets turned into this cube:

```<code>   @
>. . . .
   .
</code>```

Where the IP (instruction pointer) is started at the arrow, and . is a no-op. This just loops around forever. Take a good look and you'll see why every possible 1-byte program never ends (or does anything at all).

Length 2

```<code>.O
</code>```

Now that we've gotten over the length-1 barrier, we can finally see some output! Here's the cube net:

```<code>   .
>O . . .
   .
</code>```

where the IP starts at the arrow. O takes the TOS (top-of-stack) and outputs it as a number. If the stack is empty (e.g. at the beginning of the program), this prints 0.

When the IP gets over to the right edge of the above cube-net, it wraps back around to the left edge, onto the O again. Thus, this program prints 0 forever.

Length 3

```<code>@O/
</code>```

Our first <s>cheerleader</s> program that terminates! This gets mapped to the following net:

```<code>   @
>O / . .
   .
</code>```

where the IP starts at the arrow. As we've seen before, the O prints the TOS, which is currently 0, as a number. Next comes a new character: /. This is a mirror. There are five different mirrors: /, \, |, _, and T. Mirrors reflect the IP from one direction to another.

When the IP hits this mirror, it is redirected to the north. This puts it on the top face, which is @. Thus, the program is terminated, and the output is 0.

Length 4

```<code>@Io^
</code>```

This expands into the following cube net:

```<code>   @
>I o ^ .
   .
</code>```

A bunch of new characters here:

The first character is I, which inputs an integer from STDIN.

Next comes o. This is like O, but outputs a char-code instead of an integer.

After that, we see ^. This is one of four arrows: ^, >, v, and <. Arrows point the IP in a specific direction. ^ points the IP north, where it hits the @ and terminates.

Length 5

```<code>@i?o_
</code>```

Finally a (somewhat) useful program. This expands into the following cube net:

```<code>   @
>i ? o _
   .
</code>```

This is a cat program: it prints the entirety of the input, one char at a time.

The first character is i, which inputs a char-code from STDIN. If there's nothing in STDIN, it pushes -1.

Next comes ?. This is one of the most useful chars: it redirects the IP based on the sign of the TOS. If the TOS is negative, the IP turns left; if the TOS is positive, the IP turns right; if the TOS is zero, the IP continues in the same direction.

The combination of these chars does the following:

If the input is a null byte, the IP continues straight, outputting with o and wrapping back around to the i. (The _ is a mirror which does nothing when the IP is traveling east-west.)

If the input is anything else, the IP turns right, wrapping around to the bottom and hitting the _. This turns it around; it goes back across the bottom and hits the ? again, turning right. This time, though, it's sent through the o and back around to the i.

If there is no more input, the IP turns left, hits @, and ends the program.

Length 6

```<code>   @
>. . . .
   .
</code>```0

Our first happy program! ;) This expands into the following cube net:

```<code>   @
>. . . .
   .
</code>```1

The first character is O, which prints the TOS (currently 0). Then the IP hits a mirror / which redirects it over the top face onto the 9. Digits push themselves to the stack. Note that they do not concatenate; 12 pushes a 1 and a 2.

So now the TOS is 9. The IP comes down on the other side of the cube and hits the ), which increments the TOS by 1. Now the TOS is 10, which tells the o on the bottom face to output a newline.

The IP comes up and hits the mirror again, turning to the east. The next character it hits is the ;, which pops the TOS (removes it). The stack is now back to its natural state with infinite 0s.

Next is the ), which increments the TOS to 1. Now the IP is back at the start of the program, except the TOS is now 1 instead of 0. Can you figure out what this program does?

Feel free to add more interesting snippets!

Title: Showcase of Languages

Body:
Cubix

Click on any snippet's header to try it in the online interpreter!

For reference, the text in bold tells you the important stuff.

Factoid

Cubix is a stack-based language, created by me, which runs like a 2D language such as Befunge. The main difference? The code is run on the outside of a cube.

Length 1

@

This is pretty much the character most commonly used. Why? Because it immediately ends execution of the program. In fact, it's the only way to end the program.

This is useless as a program, though, because it gets turned into this cube:

   @
>. . . .
   .

Where the IP (instruction pointer) is started at the arrow, and . is a no-op. This just loops around forever. Take a good look and you'll see why every possible 1-byte program never ends (or does anything at all).

Length 2

.O

Now that we've gotten over the length-1 barrier, we can finally see some output! Here's the cube net:

   .
>O . . .
   .

where the IP starts at the arrow. O takes the TOS (top-of-stack) and outputs it as a number. If the stack is empty (e.g. at the beginning of the program), this prints 0.

When the IP gets over to the right edge of the above cube-net, it wraps back around to the left edge, onto the O again. Thus, this program prints 0 forever.

Length 3

@O/

Our first <s>cheerleader</s> program that terminates! This gets mapped to the following net:

   @
>O / . .
   .

where the IP starts at the arrow. As we've seen before, the O prints the TOS, which is currently 0, as a number. Next comes a new character: /. This is a mirror. There are five different mirrors: /, \, |, _, and T. Mirrors reflect the IP from one direction to another.

When the IP hits this mirror, it is redirected to the north. This puts it on the top face, which is @. Thus, the program is terminated, and the output is 0.

Length 4

@Io^

This expands into the following cube net:

   @
>I o ^ .
   .

A bunch of new characters here:

The first character is I, which inputs an integer from STDIN.

Next comes o. This is like O, but outputs a char-code instead of an integer.

After that, we see ^. This is one of four arrows: ^, >, v, and <. Arrows point the IP in a specific direction. ^ points the IP north, where it hits the @ and terminates.

Length 5

@i?o_

Finally a (somewhat) useful program. This expands into the following cube net:

   @
>i ? o _
   .

This is a cat program: it prints the entirety of the input, one char at a time.

The first character is i, which inputs a char-code from STDIN. If there's nothing in STDIN, it pushes -1.

Next comes ?. This is one of the most useful chars: it redirects the IP based on the sign of the TOS. If the TOS is negative, the IP turns left; if the TOS is positive, the IP turns right; if the TOS is zero, the IP continues in the same direction.

The combination of these chars does the following:

If the input is a null byte, the IP continues straight, outputting with o and wrapping back around to the i. (The _ is a mirror which does nothing when the IP is traveling east-west.)

If the input is anything else, the IP turns right, wrapping around to the bottom and hitting the _. This turns it around; it goes back across the bottom and hits the ? again, turning right. This time, though, it's sent through the o and back around to the i.

If there is no more input, the IP turns left, hits @, and ends the program.

Length 6

9O/;)o

Our first happy program! ;) This expands into the following cube net:

   9
>O / ; )
   o

The first character is O, which prints the TOS (currently 0). Then the IP hits a mirror / which redirects it over the top face onto the 9. Digits push themselves to the stack. Note that they do not concatenate; 12 pushes a 1 and a 2.

So now the TOS is 9. The IP comes down on the other side of the cube and hits the ), which increments the TOS by 1. Now the TOS is 10, which tells the o on the bottom face to output a newline.

The IP comes up and hits the mirror again, turning to the east. The next character it hits is the ;, which pops the TOS (removes it). The stack is now back to its natural state with infinite 0s.

Next is the ), which increments the TOS to 1. Now the IP is back at the start of the program, except the TOS is now 1 instead of 0. Can you figure out what this program does?

Feel free to add more interesting snippets!


答:
Python 2 - <s>105</s> 99 bytes

+8 bytes cos our output needs to be sorted

```<code>lambda x,y:sorted(set(int("".join(z),2)for z in __import__('itertools').permutations("0"*x+"1"*y)))
</code>```

Title: All Binary Combinations to Decimal

Body:
Disclaimer

This question is not a duplicate of this question. I'm not counting specific digits, as we already have those set in the initial parameters. This question is focusing on the decimal numbers that can be constructed from the binary strings based on the digits provided.

Challenge

Given two integers X and Y, representing the number of zeroes (0) and ones (1) respectively, calculate all the possible decimal equivalents that can be determined from creating binary strings using only the zeroes and ones provided, and display them as output.

Example 1:

Input: 0 1

Output: 1

Explanation: Only one 1 to account for, which can only be converted one way.

Example 2:

Input: 1 1

Output: 1,2

Explanation: 01 converts to 1, 10 converts to 2.

Example 3:

Input: 3 2

Output: 3,5,6,9,10,12,17,18,20,24

Explanation: Three 0s and two 1s make 00011 (3), 00101 (5), 00110 (6), 01001 (9), 01010 (10), 01100 (12), 10001 (17), 10010 (18), 10100 (20), 11000 (24)

Limitations and Rules

I will only expect your code to work where 0 < X + Y <= 16 so the maximum number in the output could only occur from 16 1s, i.e. parameters 0 and 16.

As a result of the above limitation, the range of numbers we'd expect in the output are from 0 and 65535.

I will accept functions or code, so long as the resulting output is provided, whether this be a comma separated list, an array, list outputted to STDOUT, etc. The only criteria I must stress about the output is that it must be sorted.

This is code golf, minimum bytes will receive maximum glory.

We will not tolerate silly loopholes

Body:
Python 2 - <s>105</s> 99 bytes

+8 bytes cos our output needs to be sorted

lambda x,y:sorted(set(int("".join(z),2)for z in __import__('itertools').permutations("0"*x+"1"*y)))


答:
Jelly, 8 bytes

```<code>0,1xŒ!ḄQ
</code>```

Try it online!

How it works

```<code>0,1xŒ!ḄQ Main link. Argument: [x, y]

0,1x     Repeat 0 x times and 1 y times.
    Œ!   Compute all permutations of the result.
      Ḅ   Unbinary; convert each permutation from base 2 to integer.
       Q  Unique; deduplicate the results.
</code>```

Title: All Binary Combinations to Decimal

Body:
Jelly, 8 bytes

0,1xŒ!ḄQ

Try it online!

How it works

0,1xŒ!ḄQ Main link. Argument: [x, y]

0,1x     Repeat 0 x times and 1 y times.
    Œ!   Compute all permutations of the result.
      Ḅ   Unbinary; convert each permutation from base 2 to integer.
       Q  Unique; deduplicate the results.


答:
Pyth - 11 bytes

```<code>{iR2.psmVU2
</code>```

Test Suite.

```<code>{                Uniquify
 iR2             Map i2, which converts from binary to decimal
  .p             All permutations
   s             Concatenate list
    mV           Vectorized map, which in this case is repeat
     U2          0, 1
     (Q)         Implicit input
</code>```

Title: All Binary Combinations to Decimal

Body:
Pyth - 11 bytes

{iR2.psmVU2

Test Suite.

{                Uniquify
 iR2             Map i2, which converts from binary to decimal
  .p             All permutations
   s             Concatenate list
    mV           Vectorized map, which in this case is repeat
     U2          0, 1
     (Q)         Implicit input


答:
Python, 60 bytes

lambda x,y:[n for n in range(1<<x+y)if bin(n).count('1')==y]
```

Test it on Ideone.

How it works

All positive numbers that can be represented in binary with x zeroes and y ones is clearly smaller than 2x + y, since the canonical binary representation of the latter has x + y + 1 digits.

The lambda simply iterates over the integers in [0, 2x + y) and keeps all integers n in that range that have y ones. Since n < 2x + y is can be represented with x (or less) zeroes.

Title: All Binary Combinations to Decimal

Body:
Python, 60 bytes

lambda x,y:[n for n in range(1<<x+y)if bin(n).count('1')==y]

Test it on Ideone.

How it works

All positive numbers that can be represented in binary with x zeroes and y ones is clearly smaller than 2x + y, since the canonical binary representation of the latter has x + y + 1 digits.

The lambda simply iterates over the integers in [0, 2x + y) and keeps all integers n in that range that have y ones. Since n < 2x + y is can be represented with x (or less) zeroes.


答:
JavaScript (Firefox 48), <s>85</s> <s>76</s> <s>74</s> <s>71</s> 70 bytes

Saved 3 bytes thanks to @Neil.

```<code>(m,n,g=x=>x?g(x>>1)-x%2:n)=>[for(i of Array(1<<m+n).keys())if(!g(i))i]
</code>```

Array comprehensions are awesome. Too bad they haven't made it into official ECMAScript spec yet.

JavaScript (ES6), <s>109</s> <s>87</s> <s>79</s> <s>78</s> <s>71</s> 70 bytes

```<code>(m,n,g=x=>x?g(x>>1)-x%2:n)=>[...Array(1<<m+n).keys()].filter(x=>!g(x))
</code>```

Should work in all ES6-compliant browsers now. Saved 7 bytes on this one, also thanks to @Neil.

Title: All Binary Combinations to Decimal

Body:
JavaScript (Firefox 48), <s>85</s> <s>76</s> <s>74</s> <s>71</s> 70 bytes

Saved 3 bytes thanks to @Neil.

(m,n,g=x=>x?g(x>>1)-x%2:n)=>[for(i of Array(1<<m+n).keys())if(!g(i))i]

Array comprehensions are awesome. Too bad they haven't made it into official ECMAScript spec yet.

JavaScript (ES6), <s>109</s> <s>87</s> <s>79</s> <s>78</s> <s>71</s> 70 bytes

(m,n,g=x=>x?g(x>>1)-x%2:n)=>[...Array(1<<m+n).keys()].filter(x=>!g(x))

Should work in all ES6-compliant browsers now. Saved 7 bytes on this one, also thanks to @Neil.


问:
A Fragile Quine

A Fragile Quine

A fragile quine is a quine that satisfies the property of having each substring made by removing a single character, when evaluated, produces an error.

For example. If your program asdf is a quine, then for it to be fragile, the following programs must error:

```<code>sdf
adf
asf
asd
</code>```

Your program (and all of its substrings) must be fully deterministic, and must be in the same language. A program falling into an infinite loop (that is, failing to terminate), even if not eventually producing an error is considered to "produce an error" for the purposes of this challenge.

Standard loopholes apply, including the usual quine restrictions (e.g. not able to read own source code).

For example, print("foo") is not fragile. All these substrings must error:

```<code>rint("foo")
pint("foo")
prnt("foo")
prit("foo")
prin("foo")
print"foo")
print(foo")
print("oo")
print("fo")
print("fo")
print("foo)
print("foo"
</code>```

The ones that don't error are:

```<code>print("oo")
print("fo")
print("fo")
</code>```

So it is not fragile.

An important note on quines

By consensus, any possible quine must satisfy this:

It must be possible to identify a section of the program which encodes a different part of the program. ("Different" meaning that the two parts appear in different positions.)

Furthermore, a quine must not access its own source, directly or indirectly.

Example

Since I consider JavaScript's function#toString to be "reading it's own source code", I am disallowing it. However, if I weren't to bar it, here is a fragile quine in JavaScript:

```<code>f=(n=b=`f=${f}`)=>(a=(n)==`f=${f}`,n=0,a)&(n!=b)?b:q
</code>```

Tester

Here is a program that, given the source code of your program, generates all programs that must error.

let f = (s) =>
  [...Array(s.length).keys()].map(i =>
    s.slice(0, i) + s.slice(i + 1)).join("\n");

let update = () => {
  output.innerHTML = "";
  output.appendChild(document.createTextNode(f(input.value)));
};

input.addEventListener("change", update);

update();```
<pre class="snippet-code-css lang-css prettyprint-override"><code>#output {
  white-space: pre;
}

#input, #output {
  font-family: Consolas, monospace;
}</code>```

<input id="input" value="print('foo')">

```

答:
C#, 145 bytes

```<code>_=>{var@s="_=>{{var@s={1}{0}{1};for(;79!=s.Length;){{}}System.Console.Write(s,s,'{1}');}};";for(;79!=s.Length;){}System.Console.Write(s,s,'"');};
</code>```

I've not written a quine in C# before, but higher scores are better in golf, right? :)

Infinite loop if a char is removed from the string or a digit from the magic const 79. Removing any other char results in a compile error.

Ungolfed:

```<code>/* Action<object> Quine = */ _ => // unused parameter
{
    // String of the function (well, mostly).
    // {0} placeholder for s, so the output contains the function and string.
    // {1} placeholder for " since it requires escaping.
    var@s = "_=>{{var@s={1}{0}{1};for(;79!=s.Length;){{}}System.Console.Write(s,s,'{1}');}};";

    // Infinite loop if a char is removed from the above string or if the 7 or 9 is removed.
    for(;79!=s.Length;){}

    // Print the quine.
    System.Console.Write(s,s,'"');
};
</code>```

Title: A Fragile Quine

Body:
C#, 145 bytes

_=>{var@s="_=>{{var@s={1}{0}{1};for(;79!=s.Length;){{}}System.Console.Write(s,s,'{1}');}};";for(;79!=s.Length;){}System.Console.Write(s,s,'"');};

I've not written a quine in C# before, but higher scores are better in golf, right? :)

Infinite loop if a char is removed from the string or a digit from the magic const 79. Removing any other char results in a compile error.

Ungolfed:

/* Action<object> Quine = */ _ => // unused parameter
{
    // String of the function (well, mostly).
    // {0} placeholder for s, so the output contains the function and string.
    // {1} placeholder for " since it requires escaping.
    var@s = "_=>{{var@s={1}{0}{1};for(;79!=s.Length;){{}}System.Console.Write(s,s,'{1}');}};";

    // Infinite loop if a char is removed from the above string or if the 7 or 9 is removed.
    for(;79!=s.Length;){}

    // Print the quine.
    System.Console.Write(s,s,'"');
};


问:
Write a Metaquine
A metaquine is a program which is not a quine, but whose output, when run as a program in the same language, is a quine.

The goal of this challenge is to write a metaquine. This is code-golf, so shortest code wins, with earliest answer used as a tiebreaker. Note that only full programs are acceptable, due to the definition of a quine.

Rules for Quines

Only true quines are accepted. That is, you need to print the entire source code verbatim to STDOUT, without:

reading your source code, directly or indirectly.

relying on a REPL environment which just simply evaluates and prints every expression you feed it.

relying on language features which just print out the source in certain cases.

using error messages or STDERR to write all or part of the quine. (You may write things to STDERR or produce warnings/non-fatal errors as long as STDOUT is a valid quine and the error messages are not part of it.)

the source code consisting purely of literals (whether they be string literals, numeric literals, etc.) and/or NOPs.

Any non-suppressible output (such as copyright notices, startup/shutdown messages, or a trailing line feed) may be ignored in the output for the sake of the validity of the quine.

Example

Ignoring the rule which forbids literal-only programs and built-in quining, this would be a metaquine in Seriously:

```<code>"Q"
</code>```

The program consists of the single string literal "Q", which is implicitly printed at output. When the output (Q) is run, it is a quine (Q is the built-in quine function).

答:
Fish (><>), 17 bytes

This works using the classic fish quine "r00g!;oooooooo| but adds a { which shifts the entire stack to the left so that the original program isn't a quine, but it's output, when run, is.

```<code>"{r00g!;oooooooo|
</code>```

Outputs:

```<code>"r00g!;oooooooo|
</code>```

which is a fish quine!

Title: Write a Metaquine

Body:
Fish (><>), 17 bytes

This works using the classic fish quine "r00g!;oooooooo| but adds a { which shifts the entire stack to the left so that the original program isn't a quine, but it's output, when run, is.

"{r00g!;oooooooo|

Outputs:

"r00g!;oooooooo|

which is a fish quine!


答:
Ruby, 63 bytes

A simple implementation. Golfing suggestions welcome.

->a,b{(?0*a+?1*b).chars.permutation.map{|b|(b*'').to_i 2}.uniq}
```

<p><strong>Ungolfing</strong></p>

<pre class="lang-ruby prettyprint-override"><code>def f(a,b)
  str = "0"*a+"1"*b                   # make the string of 0s and 1s
  all_perms = str.chars.permutation   # generate all permutations of the 0s and 1s
  result = []
  all_perms.do each |bin|             # map over all of the permutations
    bin = bin * ''                    # join bin together
    result << bin.to_i(2)             # convert to decimal and append
  end
  return result.uniq                  # uniquify the result and return
end
</code>```

Title: All Binary Combinations to Decimal

Body:
Ruby, 63 bytes

A simple implementation. Golfing suggestions welcome.

->a,b{(?0*a+?1*b).chars.permutation.map{|b|(b*'').to_i 2}.uniq}

Ungolfing

def f(a,b)
  str = "0"*a+"1"*b                   # make the string of 0s and 1s
  all_perms = str.chars.permutation   # generate all permutations of the 0s and 1s
  result = []
  all_perms.do each |bin|             # map over all of the permutations
    bin = bin * ''                    # join bin together
    result << bin.to_i(2)             # convert to decimal and append
  end
  return result.uniq                  # uniquify the result and return
end


问:
RGB Gradients Generation
The Challenge

Given the two uppercase hexadecimal strings (both 6 characters long, XXXXXX and YYYYYY) representing RGB values (ranging from 000000 to FFFFFF inclusive), and a positive non-zero integer N, display a linear transition of the N+2 colors generated from XXXXXX to YYYYYY that would result in a color gradient.

Example

Input

```<code>FF3762
F08800
9
</code>```

Output

Please note in our example, I've requested 9 interim steps between the two colors, therefore 11 lines will be displayed from initial color to the final color

```<code>FF3762
FD3F58
FC474E
FA4F44
F9573A
F75F31
F66727
F46F1D
F37713
F17F09
F08800
</code>```

Caveats

While I've gone with a simple linear process of deriving the integer values for the interim colors before converting them back into hexadecimal, your methods may vary. Please consider the various ways one could round up/down your numbers accordingly.

Testing

To make this interesting, I've provided a snippet to allow testing of your code, inclusive of a button to provide you with two random colors to test your code against. Displaying your results is optional, but it's encouraged!

c1=()=>('00000'+(Math.random()*(1<<24)|0).toString(16)).slice(-6);

$("#col").click(function(){
  alert("Your two colors are: "+c1()+" and "+c1()+".");
});

$("#colors").blur(function(){
  $("#test").empty();
 var colArr = $("#colors").val().split("\n");
 for(c in colArr){
   $("#test").append('
'+colArr[c]+'
')
  }

});```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.tester{height: 20px;
width: 60px;padding: 4px;border: 1px solid black;}</code>```

<button id="col">Your two colors</button>

<textarea id="colors"></textarea>

```

1) You can access two random colors for your test by clicking on the "Your two colors" button.
2) The number of interim steps will be the same as the number of characters in your PPCG username inclusive of spaces, in the case of "WallyWest" it would be 9 (as per my example above).
3) Run your code with the two colors and the number and once you have your generated list, you have the option of pasting your output into the textarea and tabbing away from it to get your generated color gradient.

My example is shown here:

I must admit, that looks pretty awesome!

Please note: As I mentioned, showing your testing of your output using the snippet is optional, but it's encouraged! :)

Output

The list output must be in the form of N+2 sets of 6 digit hex numbers separated by line feeds (\n) as shown in my example above. Output can be in the form of separate lines, space/comma separated list, an array or whatever is best suited for your language... (Thanks @nimi for the heads up) Please remember, that if you plan on testing your code with the snippet, however you separate each "color" is up to you.

Rules

This is code-golf, so the shortest solution in bytes will be crowned the winner. No loopholes, naturally. Input must accept the two strings and a number (which as I said will be equivalent to the number of letters in your username on PPCG, thus your resulting output will always be a minimum of three lines long.

答:
Pyth - 35 bytes

Horribly golfed, just gave up.

```<code>j++hQsMCm.HMsM:F+dc-FdvzCmiR16cd2Qe
</code>```

Try it online here.

Example:

Title: RGB Gradients Generation

Body:
Pyth - 35 bytes

Horribly golfed, just gave up.

j++hQsMCm.HMsM:F+dc-FdvzCmiR16cd2Qe

Try it online here.

Example:


问:
Naming ionic compounds
An ionic compound is named like so: (metal name) (non-metal suffixed with -ide). Here is a list of all the suffixes that need to be replaced with -ide:

```<code>-on -ogen -ygen -ine -orus -ur -ic -ium
</code>```

The number of atoms of each element in the compound is not used in naming ionic compounds. Ignore the multivalent metal naming rules.

```<code>NaCl -> sodium + chlorine -> sodium chloride.
K2S -> potassium + sulphur -> potassium sulphide (or sulfide).
Yb2P3 -> ytterbium + phosphorus -> ytterbium phosphide.
PbTe2 -> lead + tellurium -> lead telluride.
</code>```

A string containing an ionic compound (NaCl, K2S, Yb2P3) will be given as input. No polyatomic ions will be given. The program has to output the name of this compound.

Since nobody wants to compile the periodic table data themselves, here is a paste that has the names, symbols, and whether or not it is a metal of each element, in this order: (name) (symbol) (is metal?). You can save this to an external file (the length of the file will not be counted), or you can store the data within your program (just discount the length of that string from there.) You may not need all the information provided. Every element is seperated by a newline.

As always with code golf challenges, shortest code wins.

答:
Mathematica 252 267 254

Code

ElementData[] contains information about the elements; it is native to Mathematica.

```<code>d=ElementData; a=Reverse@SortBy[d[#,"Abbreviation"]&/@d[],StringLength[#]&];
g[e_]:=Row[{e," \[RightArrow] ", p=Row[z=(d[#,"StandardName"] &/@StringCases[e,a]),
  " + " ] , " \[RightArrow] ",p[[1,1]]<> " "<>StringReplace[p[[1,2]],
  f__~~z:"on"|"ogen"|"ygen"|"ine"|"orus"|"ur"|"ic"|"ium":> f~~"ide"] }]
</code>```

Examples

```<code>g["NaCl"]
g["K2S"]
g["Yb2P3"]
g["PbTe2"]
</code>```

Explanation

The code removes digits from the compound, then separates the elements by their abbreviated names.  It then converts the abbreviations to the standard names of elements.  Finally, it replaces the non-metal by the term with the correct suffix.

Title: Naming ionic compounds

Body:
Mathematica 252 267 254

Code

ElementData[] contains information about the elements; it is native to Mathematica.

d=ElementData; a=Reverse@SortBy[d[#,"Abbreviation"]&/@d[],StringLength[#]&];
g[e_]:=Row[{e," \[RightArrow] ", p=Row[z=(d[#,"StandardName"] &/@StringCases[e,a]),
  " + " ] , " \[RightArrow] ",p[[1,1]]<> " "<>StringReplace[p[[1,2]],
  f__~~z:"on"|"ogen"|"ygen"|"ine"|"orus"|"ur"|"ic"|"ium":> f~~"ide"] }]

Examples

g["NaCl"]
g["K2S"]
g["Yb2P3"]
g["PbTe2"]

Explanation

The code removes digits from the compound, then separates the elements by their abbreviated names.  It then converts the abbreviations to the standard names of elements.  Finally, it replaces the non-metal by the term with the correct suffix.


答:
Jelly, 3 bytes (non-competing)

Unfortunately, the required atoms are roughly 2 weeks younger than the challenge.

Metaquine

```<code>”Ṙv
</code>```

Try it online!

How it works

```<code>”Ṙv  Main link. No arguments.

”Ṙ   Set the left argument and the return value to the character 'Ṙ'.
  v  Dyadic eval; evaluate the return value with the left argument as argument.
     Executing the atom Ṙ on the argument 'Ṙ' prints a string representation of
     the character, i.e., the string "”Ṙ".
     Finally, v returns its unaltered argument, which is printed implicitly.
</code>```

Quine

```<code>”ṘṘ
</code>```

Try it online!

How it works

```<code>”ṘṘ  Main link. No arguments.

”Ṙ   Set the left argument and the return value to the character 'Ṙ'.
  Ṙ  Print a string representation of the character, i.e., the string "”Ṙ".
     (implicit) Print the unaltered return value.
</code>```

Since the second Ṙ prints the first two characters (”Ṙ), this is a proper quine by our definition.

Title: Write a Metaquine

Body:
A metaquine is a program which is not a quine, but whose output, when run as a program in the same language, is a quine.

The goal of this challenge is to write a metaquine. This is code-golf, so shortest code wins, with earliest answer used as a tiebreaker. Note that only full programs are acceptable, due to the definition of a quine.

Rules for Quines

Only true quines are accepted. That is, you need to print the entire source code verbatim to STDOUT, without:

reading your source code, directly or indirectly.

relying on a REPL environment which just simply evaluates and prints every expression you feed it.

relying on language features which just print out the source in certain cases.

using error messages or STDERR to write all or part of the quine. (You may write things to STDERR or produce warnings/non-fatal errors as long as STDOUT is a valid quine and the error messages are not part of it.)

the source code consisting purely of literals (whether they be string literals, numeric literals, etc.) and/or NOPs.

Any non-suppressible output (such as copyright notices, startup/shutdown messages, or a trailing line feed) may be ignored in the output for the sake of the validity of the quine.

Example

Ignoring the rule which forbids literal-only programs and built-in quining, this would be a metaquine in Seriously:

```<code>"Q"
</code>```

The program consists of the single string literal "Q", which is implicitly printed at output. When the output (Q) is run, it is a quine (Q is the built-in quine function).

Body:
Jelly, 3 bytes (non-competing)

Unfortunately, the required atoms are roughly 2 weeks younger than the challenge.

Metaquine

”Ṙv

Try it online!

How it works

”Ṙv  Main link. No arguments.

”Ṙ   Set the left argument and the return value to the character 'Ṙ'.
  v  Dyadic eval; evaluate the return value with the left argument as argument.
     Executing the atom Ṙ on the argument 'Ṙ' prints a string representation of
     the character, i.e., the string "”Ṙ".
     Finally, v returns its unaltered argument, which is printed implicitly.

Quine

”ṘṘ

Try it online!

How it works

”ṘṘ  Main link. No arguments.

”Ṙ   Set the left argument and the return value to the character 'Ṙ'.
  Ṙ  Print a string representation of the character, i.e., the string "”Ṙ".
     (implicit) Print the unaltered return value.

Since the second Ṙ prints the first two characters (”Ṙ), this is a proper quine by our definition.


问:
Convert to Bubble Letters
So I was playing around with my compose key, and found some cool things, one of them being that by pressing compose + ( + alphanumeric + ), you get that character inside a bubble, like so: ⓐ.

Your task in this challenge is simple, to convert ordinary text to bubble letter text.

Here are the ascii chars, the bubble characters and their Unicode code points:

```<code>0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
⓪①②③④⑤⑥⑦⑧⑨ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏ
9450 9312 9313 9314 9315 9316 9317 9318 9319 9320 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423
</code>```

Your input will contain only printable ascii characters, and if a character cannot be bubbleified, leave it as is.

This is code-golf, so shortest code in bytes wins!

Note: This is not isomorphic to my earlier challenge about small-caps conversion since unlike small-caps, bubble letters are in a mostly contiguous segment of code-points, allowing for more interesting approaches.

答:
Jelly, <s>23</s> <s>22</s> 21 bytes

```<code>“2Ỵf“2Ṇ3‘r/9.ȷ_ỌFØB,y
</code>```

Try it online!

How it works

```<code>“2Ỵf“2Ṇ3‘r/9.ȷ_FỌØB,y  Main link. Argument: s (string)

“2Ỵf“2Ṇ3‘              Yield [[50, 188, 102], [50, 180, 51]].
         r/            Reduce by range.
                       This yields [[50], [188, ..., 180], [102, ..., 51].
           9.ȷ_        Subtract these integers from 9500.
                       This yields [[9450], [9312, ..., 9320], [9398, ..., 9449]].
               Ọ       Unordinal; convert the resulting code points to characters.
                F      Flatten the resulting array of strings.
                       This yields the bubbles of
                       [0, ..., 9, A, ..., Z, a, ..., z].
                 ØB,   Pair "0...9A...Za...z" with the generated string.
                    y  Transliterate.
</code>```

Title: Convert to Bubble Letters

Body:
Jelly, <s>23</s> <s>22</s> 21 bytes

“2Ỵf“2Ṇ3‘r/9.ȷ_ỌFØB,y

Try it online!

How it works

“2Ỵf“2Ṇ3‘r/9.ȷ_FỌØB,y  Main link. Argument: s (string)

“2Ỵf“2Ṇ3‘              Yield [[50, 188, 102], [50, 180, 51]].
         r/            Reduce by range.
                       This yields [[50], [188, ..., 180], [102, ..., 51].
           9.ȷ_        Subtract these integers from 9500.
                       This yields [[9450], [9312, ..., 9320], [9398, ..., 9449]].
               Ọ       Unordinal; convert the resulting code points to characters.
                F      Flatten the resulting array of strings.
                       This yields the bubbles of
                       [0, ..., 9, A, ..., Z, a, ..., z].
                 ØB,   Pair "0...9A...Za...z" with the generated string.
                    y  Transliterate.


问:
Build a sandpile
An abelian sandpile, for our purposes, is an infinite grid with integer coordinates, initially empty of sand. After each second, a grain of sand is placed at (0,0). Whenever a grid cell has 4 or more grains of sand, it spills one grain of sand to each of its four neighbors simultaneously. The neighbors of (x,y) are (x-1,y), (x+1,y), (x,y-1), and (x,y+1).

When a cell spills, it may cause its neighbors to spill. Some facts:

This cascade will eventually stop.

The order in which the cells spill is irrelevant; the result will be the same.

Example

After 3 seconds, the grid looks like

```<code>.....
.....
..3..
.....
.....
</code>```

After 4 seconds:

```<code>.....
..1..
.1.1.
..1..
.....
</code>```

After 15 seconds:

```<code>.....
..3..
.333.
..3..
.....
</code>```

And after 16 seconds:

```<code>..1..
.212.
11.11
.212.
..1..
</code>```

The challenge

In as few bytes as possible, write a function that takes a single positive
integer t and outputs a picture of the sandpile after t seconds.

Input

A single positive integer t, in any format you choose.

Output

A picture of the sandpile after t seconds, using the characters

```<code> . 1 2 3
</code>```

Edit: Use any four distinct characters you like, or draw a picture. If you're not using ".123" or "0123", specify in your answer what the characters signify.

Unlike in the examples, your output should contain the minimal number of rows and columns necessary to show the nonzero part of the sandpile.

That is, for input 3, the output should be

```<code> 3
</code>```

For 4, the output should be

```<code> .1.
 1.1
 .1.
</code>```

Scoring

Standard golf scoring applies.

Rules

No language functions or libraries that already know what a sandpile is are allowed.

Edit: The output section has been edited, the character set restriction has been completely lifted. Use any four distinct characters or colors you like.

答:
Nim, 294 characters

```<code>import os,math,sequtils,strutils
var
 z=parseFloat paramStr 1
 y=z.sqrt.toInt+1
 w=y/%2
 b=y.newSeqWith newSeq[int] y
 x=0
proc d(r,c:int)=
 b[r][c]+=1;if b[r][c]>3:b[r][c]=0;d r-1,c;d r,c+1;d r+1,c;d r,c-1
for i in 1..z.toInt:d w,w
while b[w][x]<1:x+=1
for r in b[x..< ^x]:echo join r[x..< ^x]
</code>```

Compile and Run:

```<code>nim c -r sandbox.nim 1000
</code>```

Notes:

I was able to come up with a shorter version which uses a fixed table size, but I edited it out in favor of the dynamic one.

Once the sandbox is computed, x is calculated as the number of zero columns at the start of the middle row.

For display, the table is sliced down by excluding x rows and columns from each end.

Performance

```<code>nim c --stackTrace:off --lineTrace:off --threads:off \
      --checks:off --opt:speed sandbox.nim

time ./sandbox   10000       0.053s
time ./sandbox   20000       0.172s
time ./sandbox   30000       0.392s
time ./sandbox   40000       0.670s
time ./sandbox  100000       4.421s
time ./sandbox 1000000    6m59.047s
</code>```

Title: Build a sandpile

Body:
Nim, 294 characters

import os,math,sequtils,strutils
var
 z=parseFloat paramStr 1
 y=z.sqrt.toInt+1
 w=y/%2
 b=y.newSeqWith newSeq[int] y
 x=0
proc d(r,c:int)=
 b[r][c]+=1;if b[r][c]>3:b[r][c]=0;d r-1,c;d r,c+1;d r+1,c;d r,c-1
for i in 1..z.toInt:d w,w
while b[w][x]<1:x+=1
for r in b[x..< ^x]:echo join r[x..< ^x]

Compile and Run:

nim c -r sandbox.nim 1000

Notes:

I was able to come up with a shorter version which uses a fixed table size, but I edited it out in favor of the dynamic one.

Once the sandbox is computed, x is calculated as the number of zero columns at the start of the middle row.

For display, the table is sliced down by excluding x rows and columns from each end.

Performance

nim c --stackTrace:off --lineTrace:off --threads:off \
      --checks:off --opt:speed sandbox.nim

time ./sandbox   10000       0.053s
time ./sandbox   20000       0.172s
time ./sandbox   30000       0.392s
time ./sandbox   40000       0.670s
time ./sandbox  100000       4.421s
time ./sandbox 1000000    6m59.047s


答:
Ruby, <s>38</s> 34 + 1 = 35 bytes

+1 byte for -p flag. Takes input on STDIN.

-3 bytes thanks to Dennis.

```<code>$_.tr!"A-Za-z0-9","Ⓐ-⓪①-⑨"
</code>```

See it on eval.in: https://eval.in/636978

Title: Convert to Bubble Letters

Body:
So I was playing around with my compose key, and found some cool things, one of them being that by pressing compose + ( + alphanumeric + ), you get that character inside a bubble, like so: ⓐ.

Your task in this challenge is simple, to convert ordinary text to bubble letter text.

Here are the ascii chars, the bubble characters and their Unicode code points:

```<code>0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
⓪①②③④⑤⑥⑦⑧⑨ⓐⓑⓒⓓⓔⓕⓖⓗⓘⓙⓚⓛⓜⓝⓞⓟⓠⓡⓢⓣⓤⓥⓦⓧⓨⓩⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊⓋⓌⓍⓎⓏ
9450 9312 9313 9314 9315 9316 9317 9318 9319 9320 9424 9425 9426 9427 9428 9429 9430 9431 9432 9433 9434 9435 9436 9437 9438 9439 9440 9441 9442 9443 9444 9445 9446 9447 9448 9449 9398 9399 9400 9401 9402 9403 9404 9405 9406 9407 9408 9409 9410 9411 9412 9413 9414 9415 9416 9417 9418 9419 9420 9421 9422 9423
</code>```

Your input will contain only printable ascii characters, and if a character cannot be bubbleified, leave it as is.

This is code-golf, so shortest code in bytes wins!

Note: This is not isomorphic to my earlier challenge about small-caps conversion since unlike small-caps, bubble letters are in a mostly contiguous segment of code-points, allowing for more interesting approaches.

Body:
Ruby, <s>38</s> 34 + 1 = 35 bytes

+1 byte for -p flag. Takes input on STDIN.

-3 bytes thanks to Dennis.

$_.tr!"A-Za-z0-9","Ⓐ-⓪①-⑨"

See it on eval.in: https://eval.in/636978


问:
4-way intersection generator
Here is an ASCII-art of a 4-way intersection:

```<code>     |  |  |
     |     |
     |  |  |
     |     |
     |  |  |
-----+-----+-----
     |     |
- - -|     |- - -
     |     |
-----+-----+-----
     |  |  |
     |     |
     |  |  |
     |     |
     |  |  |
</code>```

(Note how the horizontal roads are 3 rows tall, while the vertical roads are 5 columns wide. This is for aesthetic reasons, because of the rectangular font.)

Your challenge is to produce this ASCII art. However, as I'm sure you all know, not every intersection has a road travelling off in every single direction. This particular intersection goes NESW, but some intersections might go, for example, NW:

```<code>     |  |  |
     |     |
     |  |  |
     |     |
     |  |  |
-----+-----+
     |     |
- - -|     |
     |     |
-----+-----+
</code>```

Or it might go SWE:

```<code>-----+-----+-----
     |     |
- - -|     |- - -
     |     |
-----+-----+-----
     |  |  |
     |     |
     |  |  |
     |     |
     |  |  |
</code>```

Or it may even go E, just a single direction (although you can hardly call this an intersection, but try to avoid being overly pedantic):

```<code>     +-----+-----
     |     |
     |     |- - -
     |     |
     +-----+-----
</code>```

You need to write a program or function that can easily generate any of these combinations. More specifically, your challenge is to write a program or function that takes a string of directions, consisting of NESW, as input, and outputs or returns this ASCII art of an intersection with roads pointing in those directions. These directions may appear in any order, but the input will not contain any characters except for N, E, S, or W. If you like, you may request inputs to be lowercase instead, but you must specify this in your answer. You may also assume that all inputs will contain at least one direction.

The last example had leading spaces on each line, because there is no road going west. If you do not have a road going west, these leading spaces are optional. This:

```<code>+-----+-----
|     |
|     |- - -
|     |
+-----+-----
</code>```

Would also be an acceptable output. Similarly, if N or S is gone, empty lines in there place are optional. One trailing newline is allowed, and trailing spaces are allowed as long as the output is visually the same.

You may take input and output in any reasonable format, such as STDIN/STDOUT, command line args, files, function arguments/return values, etc.

As usual, this is code-golf, so try to get the shortest possible answer in whatever language you happen to use!

Sample IO:

```<code>NESW:

     |  |  |
     |     |
     |  |  |
     |     |
     |  |  |
-----+-----+-----
     |     |
- - -|     |- - -
     |     |
-----+-----+-----
     |  |  |
     |     |
     |  |  |
     |     |
     |  |  |

NS:

|  |  |
|     |
|  |  |
|     |
|  |  |
+-----+
|     |
|     |
|     |
+-----+
|  |  |
|     |
|  |  |
|     |
|  |  |

S:

+-----+
|     |
|     |
|     |
+-----+
|  |  |
|     |
|  |  |
|     |
|  |  |

EW:

-----+-----+-----
     |     |
- - -|     |- - -
     |     |
-----+-----+-----

SE:
+-----+-----
|     |
|     |- - -
|     |
+-----+-----
|  |  |
|     |
|  |  |
|     |
|  |  |
</code>```

Title: 4-way intersection generator

Body:
Python 2, 290 bytes

t,s,r,i=[],[],range(5),raw_input()
for n in r:t+=[" "*5*("W"in i)+"|  "+("|"," ")[n%2]+"  |"]
exec"s+=['-'*5];s[:1]+=' '*5,;"*2;s[:2]+="- - -",
if"N"in i:print'\n'.join(t)
print'\n'.join([s[n]*("W"in i)+("|     |","+-----+")[`n`in"04"]+s[n]*("E"in i)for n in r])
if"S"in i:print'\n'.join(t)


答:
Bash on OSX, 27

3 bytes saved thanks to @Dennis.

```<code>  tr A-Za-z0-9 Ⓐ-⓪①-⑨
</code>```

I/O via STDIN/STDOUT.  The OSX tr apparently handles these unicode characters whereas the GNU coreutils tr does not.

Title: Convert to Bubble Letters

Body:
Bash on OSX, 27

3 bytes saved thanks to @Dennis.

  tr A-Za-z0-9 Ⓐ-⓪①-⑨

I/O via STDIN/STDOUT.  The OSX tr apparently handles these unicode characters whereas the GNU coreutils tr does not.


答:
Mathematica, <s>59</s> 57 bytes

A usual outcome with Mathematica: high-level functions = good, long function names = bad.

```<code>#+##&~Fold~#&/@Permutations@Join[0&~Array~#,1&~Array~#2]&
</code>```

Join[0&~Array~#,1&~Array~#2] creates a list with the correct number of 0s and 1s. Permutations generates all permutations of that list, without repetitions (as I learned) and in sorted order. #+##&~Fold~# (a golfuscated version of #~FromDigits~2) converts a list of base-2 digits into the integer they represent.

Previous version, before Martin Ender's comment:

```<code>#~FromDigits~2&/@Permutations@Join[0&~Array~#,1&~Array~#2]&
</code>```

Title: All Binary Combinations to Decimal

Body:
Disclaimer

This question is not a duplicate of this question. I'm not counting specific digits, as we already have those set in the initial parameters. This question is focusing on the decimal numbers that can be constructed from the binary strings based on the digits provided.

Challenge

Given two integers X and Y, representing the number of zeroes (0) and ones (1) respectively, calculate all the possible decimal equivalents that can be determined from creating binary strings using only the zeroes and ones provided, and display them as output.

Example 1:

Input: 0 1

Output: 1

Explanation: Only one 1 to account for, which can only be converted one way.

Example 2:

Input: 1 1

Output: 1,2

Explanation: 01 converts to 1, 10 converts to 2.

Example 3:

Input: 3 2

Output: 3,5,6,9,10,12,17,18,20,24

Explanation: Three 0s and two 1s make 00011 (3), 00101 (5), 00110 (6), 01001 (9), 01010 (10), 01100 (12), 10001 (17), 10010 (18), 10100 (20), 11000 (24)

Limitations and Rules

I will only expect your code to work where 0 < X + Y <= 16 so the maximum number in the output could only occur from 16 1s, i.e. parameters 0 and 16.

As a result of the above limitation, the range of numbers we'd expect in the output are from 0 and 65535.

I will accept functions or code, so long as the resulting output is provided, whether this be a comma separated list, an array, list outputted to STDOUT, etc. The only criteria I must stress about the output is that it must be sorted.

This is code golf, minimum bytes will receive maximum glory.

We will not tolerate silly loopholes

Body:
Mathematica, <s>59</s> 57 bytes

A usual outcome with Mathematica: high-level functions = good, long function names = bad.

#+##&~Fold~#&/@Permutations@Join[0&~Array~#,1&~Array~#2]&

Join[0&~Array~#,1&~Array~#2] creates a list with the correct number of 0s and 1s. Permutations generates all permutations of that list, without repetitions (as I learned) and in sorted order. #+##&~Fold~# (a golfuscated version of #~FromDigits~2) converts a list of base-2 digits into the integer they represent.

Previous version, before Martin Ender's comment:

#~FromDigits~2&/@Permutations@Join[0&~Array~#,1&~Array~#2]&


答:
Retina, 20 bytes

```<code>T`Lld`Ⓐ-⓪①-⑨
</code>```

Try it online!

How it works

There's a gap between the code points of (0) and (1), but – fortunately – the character right after (z) is (0). This way, we can transliterate the character from concatenated ranges A-Za-z0-9 to the characters of the concatenated ranges (A)-(0)(1)-(9).

The rest is straightforward: T activates transliteration mode, Lld yields all uppercase ASCII letters (L), all lowercase ASCII letters (l) and all digits (d), and Ⓐ-⓪①-⑨ the corresponding bubble characters.

Title: Convert to Bubble Letters

Body:
Retina, 20 bytes

T`Lld`Ⓐ-⓪①-⑨

Try it online!

How it works

There's a gap between the code points of (0) and (1), but – fortunately – the character right after (z) is (0). This way, we can transliterate the character from concatenated ranges A-Za-z0-9 to the characters of the concatenated ranges (A)-(0)(1)-(9).

The rest is straightforward: T activates transliteration mode, Lld yields all uppercase ASCII letters (L), all lowercase ASCII letters (l) and all digits (d), and Ⓐ-⓪①-⑨ the corresponding bubble characters.


答:
CJam (15 14 bytes)

```<code>{As.*s:~e!2fb}
</code>```

This is an anonymous block (function) which takes input as an array [number-of-ones number-of-zeros] and returns output as an array.

Online demo

A long way off the mark, but more interesting: this is without permutation builtins or base conversion:

```<code>{2\f#~1$*:X;[({___~)&_2$+@1$^4/@/|_X<}g;]}
</code>```

It would work nicely as a GolfScript unfold.

Title: All Binary Combinations to Decimal

Body:
CJam (15 14 bytes)

{As.*s:~e!2fb}

This is an anonymous block (function) which takes input as an array [number-of-ones number-of-zeros] and returns output as an array.

Online demo

A long way off the mark, but more interesting: this is without permutation builtins or base conversion:

{2\f#~1$*:X;[({___~)&_2$+@1$^4/@/|_X<}g;]}

It would work nicely as a GolfScript unfold.


问:
Rolling three dice and show the probabilities
Roll 3 dice, count the two highest two values and add them to the result. Every 1 must be rolled once again.

Now show the average throw after 1000000 tries and the probabilities for each result occurring:

Desired Result:

avg(9.095855)

  2: 0.0023

  3: 0.0448

  4: 1.1075

  5: 2.8983

  6: 6.116

  7: 10.1234

  8: 15.4687

  9: 18.9496

  10: 19.3575

  11: 16.0886

  12: 9.8433

Body:
C - 200

I didn't bother to re-roll on 1, instead I used the probability distribution (1/36 chance of rolling 1, 7/36 chance of rolling anything else). Hopefully this is acceptable. Newline has been inserted for clarity.

#define D 6-rand()%36/7
a,b,c,t,u,w,y[13];
main(v,q){srand(q);for(;v++<=1e6;u=(a=D)<(b=D)?a:b,w+=t=a+b+(c=D)-(u<c?u:c))y[t]++;
printf("avg(%f)\n",w/1e6);for(v=1;++v<13;)printf("%d: %f\n",v,y[v]/1e4);}

After compilation (gcc -O3) - 1 run

avg(9.096896)
2: 0.002200
3: 0.043100
4: 1.093900
5: 2.891000
6: 6.110100
7: 10.091400
8: 15.605000
9: 18.936500
10: 19.258800
11: 16.047100
12: 9.920800


答:
JavaScript (ES6) 93 <s>104</s>

Edit 11 bytes saved thx @Neil again

Having to use String.fromCharCode, javascript is doomed...

s=>s.replace(/[^\W_]/g,c=>String.fromCharCode(9388+parseInt(c,36)+(-c?-77:62-c||c>'Z'&&26)))
```
<p><strong>Test</strong></p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>f=
s=>s.replace(/[^\W_]/g,c=>String.fromCharCode(9388+parseInt(c,36)+(-c?-77:62-c||c>'Z'&&26)))

function update() {
  O.textContent=f(I.value)
}

update()</code>```

<input id=I oninput="update()" value='Hello world!'>

```</code>```

Title: Convert to Bubble Letters

Body:
JavaScript (ES6) 93 <s>104</s>

Edit 11 bytes saved thx @Neil again

Having to use String.fromCharCode, javascript is doomed...

s=>s.replace(/[^\W_]/g,c=>String.fromCharCode(9388+parseInt(c,36)+(-c?-77:62-c||c>'Z'&&26)))

Test

f=
s=>s.replace(/[^\W_]/g,c=>String.fromCharCode(9388+parseInt(c,36)+(-c?-77:62-c||c>'Z'&&26)))

function update() {
  O.textContent=f(I.value)
}

update()

<input id=I oninput="update()" value='Hello world!'>
<pre id=O></pre>


问:
Greater than less than greater than something fishy
Given a length N string of less-than and greater-than signs (<, >), insert the integers 0 through N at the start and end and in between each pair of signs such that all the inequalities are satisfied. Output the resulting string. If there are multiple valid outputs, output any one (and just one) of them.

For example

```<code><<><><<
</code>```

has 7 characters so all the numbers from 0 to 7 inclusive must be inserted. A valid output is

```<code>2<3<4>1<5>0<6<7
</code>```

because all the inequalities taken one at a time

```<code>2<3
3<4
4>1
1<5
5>0
0<6
6<7
</code>```

are true.

If desired, the output may have spaces surrounding the signs, e.g. 2 < 3 < 4 > 1 < 5 > 0 < 6 < 7.

The shortest code in bytes wins.

Test Cases

The first line after an empty line is the input and the next line(s) are each valid output examples.

```<code>[empty string]
0

<
0<1

>
1>0

<<
0<1<2

<>
1<2>0

><
1>0<2
2>0<1

>>
2>1>0

<<<
0<1<2<3

><>
1>0<3>2

>><
3>2>0<1
3>1>0<2
2>1>0<3

>>>
3>2>1>0

>>><<<
3>2>1>0<4<5<6
6>3>1>0<2<4<5
4>2>1>0<3<5<6
4>3>1>0<2<5<6

<<><><<
2<3<4>1<5>0<6<7

>><><>>
7>6>0<5>1<4>3>2

<<<<<<<<<<<<<<
0<1<2<3<4<5<6<7<8<9<10<11<12<13<14

>><<<<><>><><<
6>5>4<7<8<9<10>3<11>2>1<12>0<13<14
14>5>4<7<8<9<10>3<11>2>1<12>0<13<6
</code>```

答:
Python 2, 67 bytes

f=lambda s,i=0:s and`i+len(s)*(s>'=')`+s[0]+f(s[1:],i+(s<'>'))or`i`
```

A recursive function. Satisfies each operator in turn by putting the smallest unused value x for x< and greatest for x>. The smallest unused value is stored in i and updated, and the largest unused value is inferred from i and the remaining length.

Body:
Python 2, 67 bytes

f=lambda s,i=0:s and`i+len(s)*(s>'=')`+s[0]+f(s[1:],i+(s<'>'))or`i`

A recursive function. Satisfies each operator in turn by putting the smallest unused value x for x< and greatest for x>. The smallest unused value is stored in i and updated, and the largest unused value is inferred from i and the remaining length.


问:
Shortest code to produce infinite output
Write the shortest code you can that produces an infinite output.

That's all. You code will only be disqualified if it stops producing output at some point. As always in code golf, the shortest code wins.

Here's a list of answers that I think are really clever, so they can get credit:

The comma is both code and data

Infinite errors (that counts)

Infinite warnings (that also counts)

What's Marbelous?

Leaderboard

var QUESTION_ID=13152,OVERRIDE_USER=8611;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&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(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.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(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body;s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="
"+e.body.replace(OVERRIDE_REG,"")+"
")});var a=r.match(SCORE_REG);a&&e.push({user:getAuthorName(s),size:+a[2],language:a[1],link:s.share_link})}),e.sort(function(e,s){var r=e.size,a=s.size;return r-a});var s={},r=1,a=null,n=1;e.forEach(function(e){e.size!=a&&(n=r),a=e.size,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.language).replace("{{SIZE}}",e.size).replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);var o=e.language;/s.lang?1:e.lang<s.lang?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SIZE}}",o.size).replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var SCORE_REG=/<h\d>\s*([^\n,]*[^\s,]),.*?(\d+)(?=[^\n\d<>]*(?:<(?:s>[^\n<>]*<\/s>|[^\n<>]+>)[^\n\d<>]*)*<\/h\d>)/,OVERRIDE_REG=/^Override\s*header:\s*/i;```
<pre class="snippet-code-css lang-css prettyprint-override"><code>body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}</code>```

 <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

```

答:
Woefully, 49 bytes (newer than challenge)

```<code>||| |
|| |
| |
|| |
||| |
|||| |
||||| |
|||||| |
</code>```

Explanation

```<code>v     v represents char pointer, instruction pointer finds first space after the char
|||A|                                                      pointed at by char pointer
||A|  A- Push zero
|A|
||B|
|||B| B- Pop and print (number)
||||B|
|||||B|
||||||B|
    [end] End- go back to character char pointer is pointing at. Char pointer has not moved
so it will just execute the same again
</code>```

Body:
Woefully, 49 bytes (newer than challenge)

||| |
|| |
| |
|| |
||| |
|||| |
||||| |
|||||| |

Explanation

v     v represents char pointer, instruction pointer finds first space after the char
|||A|                                                      pointed at by char pointer
||A|  A- Push zero
|A|
||B|
|||B| B- Pop and print (number)
||||B|
|||||B|
||||||B|
    [end] End- go back to character char pointer is pointing at. Char pointer has not moved
so it will just execute the same again


答:
Brachylog

Factoid

Brachylog is a declarative logic programming language based on Prolog. Its name is constituted of the prefix brachy- (meaning short, from ancient greek βραχύς) and the suffix -log, to mark its link to Prolog.

Length 1

```<code>r
</code>```

A seemingly simple program, that is useful to understand some fundamental basics about Brachylog (and declarative programming in general): Reverse something.

In Brachylog, the program r is a main predicate consisting of one rule (namely, r). All rules in Brachylog implicitely start with the Input (noted ?) and end with the Output (noted .).

Therefore, our program is really ?r., which can be read as Output is the reverse of the Input. The built-in r - Reverse works on the three main data types of Brachylog: lists, strings and integers.

But more interestingly, it is a relationship that we state with r, not a one-way function like most programming languages. As such, r also works as expected when the Output is ground and the Input is not! It even works if both the input and the output have no value, though that doesn't show well on the online interpreter and with a program limited to one character.

We will continues to see in the next examples that predicates in Brachylog are relationships between variables and are as such much more expressive than traditional imperative function. We can also note that the Input and Output of predicates are merely called that because that's usually how those variables are used, but those are simply names and they don't mean that for example the Input necessarily has to be a ground variable.

Length 2

```r?```

Now that we know that r is reverse, and that ? is the Input, you can probably guess what this program does: test whether the input is a palindrome or not.

Indeed, r? is really ?r?., which can be read as: Input is the reverse of the Input, and Output is the same as the Input. Since we do not need the Output at all here, the second part of the sentence can be disregarded and we then see that it is indeed a palindromeness checking program.

The program .r would have worked the same if we passed our input through the Output variable.

Length 3

```:^a```

As you can see from the TIO link, the code above squares each element of the input. ^ being the squaring built-in predicate, and a being Apply, a meta-predicate.

In Brachylog, all predicates have only an input and an output argument. Therefore, when we need to "pass" more than one thing to the predicate, we put them in a list.

This is what we are doing with :, which is also the list separator. By writing :^, we are constructing the list [Input, brachylog_power]. So, just like numbers, strings and lists, we can also put predicates in lists.

Apply takes the last element of its input argument as being a predicate, and queries that predicate each time with an element of the rest of its input argument as input (hence why it is called a meta-predicate). The output of apply accumulates the outputs of the queries. This predicate is usually called map in other languages (maplist in Prolog).

Length 4

```:@[f```

Continuing on meta-predicates, here is f: Findall. As its name suggests, this will find all valid outputs of a predicate for a specific input.

Here, the input to Findall is the list [Input, brachylog_string_prefix]. The predicate string_prefix @[ is true if its output is a prefix of the input. By running Findall on it, we will obtain all prefixes of ?.

Note that the string in string_prefix only comes from the fact that it is a 2 symbols predicate which starts with @ (which represent operations that are more often done on strings). This predicate of course doesn't only work on strings, but also on integers and lists.

Length 5

```:Lc.r```

This is probably my favorite Brachylog program (most likely because it is twice as short as the Jelly answer on this challenge!). This is a program which palindromizes its input.

In Brachylog, strings and integers can contain variable characters/digits, just like how lists can contain variables as elements. Therefore, :Lc. means “Output is the result of concatenating the Input and a variable L”. Then, we impose with .r that the output reversed is still the output (thus, that the output is a palindrome). This will force Brachylog to unify the variable values of L so that the output is indeed a palindrome.

Length 6

```:1f
~c
```

Here is another example of the use of f - Findall and c - Concatenate.

The first line is the main predicate and states “Find all valid outputs of predicate 1 given the Input as input”. The second line is predicate 1 and states The output, when concatenated, results in the Input.

Here, ~ is a simple control symbol which "flips" the arguments of the following predicate: AcZ means “Z is the result of concatenating the elements of A” whereas A~cZ means “concatenating the elements of Z results in A”.

Therefore the program above will find all possible lists of strings (excluding the ones containing the empty string), which when concatenated will result in the input.

Note that ~c is not a second built-in which does the reverse of c ; it is the same as c, but called with swapped arguments. To convince you of this, rewriting predicate 1 as ,.c?, will result in the same program.

Side note: this program could have been written :{~c}f, which does the exact same thing. Choosing one or the other is mostly a matter of preference.

Length 7

```:1y
#p=```

This demonstrates another meta-predicate: y - Yield, and a major feature of Brachylog: constraints-based arithmetic.

y - Yield is a meta predicate very similar to f - Findall, the difference between the two being that y will unify its output with the first N outputs of the queried predicate (N being the penultimate element of the input arguments), instead of all of the outputs. This is thus very useful for predicates that have an infinite number of choice points, such as arithmetic series.

In Brachylog, all integer arithmetic is based on constraints. This makes operations on integers very declarative in nature ; if we declare the relationship that X + Y = Z (which in Brachylog would be written as X:Y+Z), then this constraint will hold even if those variables have no ground value. Adding more and more constraints will keep on reducing the search space for the possible values of those variables. Then, the labeling process (using = in Brachylog) will assign values to variables such that they respect all constraints that were applied to them.

#p - constraint_prime is a predicate which constrains its input ? (which is unified with its output .) such that it must be a prime number. Using = - Equals, we can then label that variable so that it takes a ground value. The labeling process will order choice points according to the magnitude of the values, which is why overall this program yields the first N prime numbers, starting from 2.

Length 8

```~l<:#pa=```

As you can see, this does exactly the same thing as the previous 7 bytes program. This one though is much more easier to describe and understand.

We use ~l to get a list whose length is the Input. We then impose with < that the list must contain integers and must be strictly increasing. Using Apply, :#pa then constrains each integer of the list to be a prime number. We then use = to label the values of that list, which results in a strictly increasing list of prime numbers.

Length 9

```#0|@e+:0&```

This program computes the digital root of its input.

Just like in Prolog, we can write multiple rules for a single predicate, using |: the first rule #0 constrains the Input = the Ouput to be a single digit. If this is not possible, the second rule @e+:0& will split the input as a list of digits, then sum them and call Predicate 0 (the main predicate) recursively.

Title: Showcase of Languages

Body:
Notes

This thread is open and unlocked only because the community decided to make an exception. Please do not use this question as evidence that you can ask similar questions here. Please do not create additional showcase questions.

This is no longer a popularity-contest, nor are snippet lengths limited by the vote tally. If you know this thread from before, please make sure you familiarize yourself with the changes.

This thread is dedicated to showing off interesting, useful, obscure, and/or unique features your favorite programming languages have to offer. This is neither a challenge nor a competition, but a collaboration effort to showcase as many programming languages as possible as well as possible.

How this works

All answers should include the name of the programming language at the top of the post, prefixed by a #.

Answers may contain one (and only one) factoid, i.e., a couple of sentences without code that describe the language.

Aside from the factoid, answers should consist of snippets of code, which can (but don't have to be) programs or functions.

The snippets do not need to be related. In fact, snippets that are too related may be redundant.

Since this is not a contest, all programming languages are welcome, whenever they were created.

Answers that contain more than a handful of code snippets should use a Stack Snippet to collapse everything except the factoid and one of the snippets.

Whenever possible, there should be only one answer per programming language. This is a community wiki, so feel free to add snippets to any answer, even if you haven't created it yourself. There is a Stack Snippet for compressing posts, which should mitigate the effect of the 30,000 character limit.

Answers that predate these guidelines should be edited. Please help updating them as needed.

Current answers, sorted alphabetically by language name

$.ajax({type:"GET",url:"https://api.stackexchange.com/2.2/questions/44680/answers?site=codegolf&filter=withbody",success:function(data){for(var i=0;i<data.items.length;i++){var temp=document.createElement('p');temp.innerHTML = data.items[i].body.split("\n")[0];$('#list').append('
' + temp.innerText || temp.textContent + '');}}})```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><base href="http://codegolf.stackexchange.com"><ul id="list"></ul></code>```

Body:
Brachylog

Factoid

Brachylog is a declarative logic programming language based on Prolog. Its name is constituted of the prefix brachy- (meaning short, from ancient greek βραχύς) and the suffix -log, to mark its link to Prolog.

Length 1

r

A seemingly simple program, that is useful to understand some fundamental basics about Brachylog (and declarative programming in general): Reverse something.

In Brachylog, the program r is a main predicate consisting of one rule (namely, r). All rules in Brachylog implicitely start with the Input (noted ?) and end with the Output (noted .).

Therefore, our program is really ?r., which can be read as Output is the reverse of the Input. The built-in r - Reverse works on the three main data types of Brachylog: lists, strings and integers.

But more interestingly, it is a relationship that we state with r, not a one-way function like most programming languages. As such, r also works as expected when the Output is ground and the Input is not! It even works if both the input and the output have no value, though that doesn't show well on the online interpreter and with a program limited to one character.

We will continues to see in the next examples that predicates in Brachylog are relationships between variables and are as such much more expressive than traditional imperative function. We can also note that the Input and Output of predicates are merely called that because that's usually how those variables are used, but those are simply names and they don't mean that for example the Input necessarily has to be a ground variable.

Length 2

r?

Now that we know that r is reverse, and that ? is the Input, you can probably guess what this program does: test whether the input is a palindrome or not.

Indeed, r? is really ?r?., which can be read as: Input is the reverse of the Input, and Output is the same as the Input. Since we do not need the Output at all here, the second part of the sentence can be disregarded and we then see that it is indeed a palindromeness checking program.

The program .r would have worked the same if we passed our input through the Output variable.

Length 3

:^a

As you can see from the TIO link, the code above squares each element of the input. ^ being the squaring built-in predicate, and a being Apply, a meta-predicate.

In Brachylog, all predicates have only an input and an output argument. Therefore, when we need to "pass" more than one thing to the predicate, we put them in a list.

This is what we are doing with :, which is also the list separator. By writing :^, we are constructing the list [Input, brachylog_power]. So, just like numbers, strings and lists, we can also put predicates in lists.

Apply takes the last element of its input argument as being a predicate, and queries that predicate each time with an element of the rest of its input argument as input (hence why it is called a meta-predicate). The output of apply accumulates the outputs of the queries. This predicate is usually called map in other languages (maplist in Prolog).

Length 4

:@[f

Continuing on meta-predicates, here is f: Findall. As its name suggests, this will find all valid outputs of a predicate for a specific input.

Here, the input to Findall is the list [Input, brachylog_string_prefix]. The predicate string_prefix @[ is true if its output is a prefix of the input. By running Findall on it, we will obtain all prefixes of ?.

Note that the string in string_prefix only comes from the fact that it is a 2 symbols predicate which starts with @ (which represent operations that are more often done on strings). This predicate of course doesn't only work on strings, but also on integers and lists.

Length 5

:Lc.r

This is probably my favorite Brachylog program (most likely because it is twice as short as the Jelly answer on this challenge!). This is a program which palindromizes its input.

In Brachylog, strings and integers can contain variable characters/digits, just like how lists can contain variables as elements. Therefore, :Lc. means “Output is the result of concatenating the Input and a variable L”. Then, we impose with .r that the output reversed is still the output (thus, that the output is a palindrome). This will force Brachylog to unify the variable values of L so that the output is indeed a palindrome.

Length 6

:1f
~c

Here is another example of the use of f - Findall and c - Concatenate.

The first line is the main predicate and states “Find all valid outputs of predicate 1 given the Input as input”. The second line is predicate 1 and states The output, when concatenated, results in the Input.

Here, ~ is a simple control symbol which "flips" the arguments of the following predicate: AcZ means “Z is the result of concatenating the elements of A” whereas A~cZ means “concatenating the elements of Z results in A”.

Therefore the program above will find all possible lists of strings (excluding the ones containing the empty string), which when concatenated will result in the input.

Note that ~c is not a second built-in which does the reverse of c ; it is the same as c, but called with swapped arguments. To convince you of this, rewriting predicate 1 as ,.c?, will result in the same program.

Side note: this program could have been written :{~c}f, which does the exact same thing. Choosing one or the other is mostly a matter of preference.

Length 7

:1y
#p=

This demonstrates another meta-predicate: y - Yield, and a major feature of Brachylog: constraints-based arithmetic.

y - Yield is a meta predicate very similar to f - Findall, the difference between the two being that y will unify its output with the first N outputs of the queried predicate (N being the penultimate element of the input arguments), instead of all of the outputs. This is thus very useful for predicates that have an infinite number of choice points, such as arithmetic series.

In Brachylog, all integer arithmetic is based on constraints. This makes operations on integers very declarative in nature ; if we declare the relationship that X + Y = Z (which in Brachylog would be written as X:Y+Z), then this constraint will hold even if those variables have no ground value. Adding more and more constraints will keep on reducing the search space for the possible values of those variables. Then, the labeling process (using = in Brachylog) will assign values to variables such that they respect all constraints that were applied to them.

#p - constraint_prime is a predicate which constrains its input ? (which is unified with its output .) such that it must be a prime number. Using = - Equals, we can then label that variable so that it takes a ground value. The labeling process will order choice points according to the magnitude of the values, which is why overall this program yields the first N prime numbers, starting from 2.

Length 8

~l<:#pa=

As you can see, this does exactly the same thing as the previous 7 bytes program. This one though is much more easier to describe and understand.

We use ~l to get a list whose length is the Input. We then impose with < that the list must contain integers and must be strictly increasing. Using Apply, :#pa then constrains each integer of the list to be a prime number. We then use = to label the values of that list, which results in a strictly increasing list of prime numbers.

Length 9

#0|@e+:0&

This program computes the digital root of its input.

Just like in Prolog, we can write multiple rules for a single predicate, using |: the first rule #0 constrains the Input = the Ouput to be a single digit. If this is not possible, the second rule @e+:0& will split the input as a list of digits, then sum them and call Predicate 0 (the main predicate) recursively.