# 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 questions.

• This is no longer a , 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.

### 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('<li><a href="/a/' + data.items[i].answer_id + '">' + temp.innerText || temp.textContent + '</a>');}}})
<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>

# 4-byte code

0^*2


(Prints 000)

I have chosen to use this snippet because of its weirdness. So the first bit of the code says that the stack is 0. Then the * is string multiplication. It multiplies "0" 2 times. One would expect the output to be 00, but no! 000 is outputted instead. So the stack is repeated 2+1=3 times, which gives 000. This trick is useful for golfing when you want to output the stack 10 times. Instead of going (stack)^*10, you will do (stack)^*9 because it saves one byte!

# 3-byte code

$^P  The $ is the alternative to # for taking input. In the future I hope to distinguish these two similar functions... Coming back to the topic, we see the caret ^ for the first time. This is to differentiate the stack from the commands. Then comes the P. This checks if the stack is a prime or not(works for the number 1). This primality checking works on the stack both as a string or as a number. This "special power" of P can make it more useful for code-golfing.

# 2-byte code

#A


Outputs inputA. If the input is C, then the output would be CA

This piece of code shows two interesting properties of Carrot:

1. One is that the string "A" does not need to be enclosed in quotes in the stack.
2. The other one is that the plus "+" sign for concatenation is not required in the stack. The two strings, the input and the "A", get joined together automatically.

# 1-byte code

#


This is a simple program that prints the output as it is. The # can be used in the commands or the stack section of the program. The caret ^ is not required because we do not wish to use commands.

Factoid: Carrot is a language made by me, Kritixi Lithos, based on this carrot meme of PPCG. Every Carrot program as of version ^2 must have a ^ in it. The structure of every program is as follows: stack^commands.

• whaaat no carrot required? XD – Conor O'Brien Nov 3 '15 at 17:21
• @CᴏɴᴏʀO'Bʀɪᴇɴ Carets are not required from Version ^3 and forth if we want to use no commands. – Kritixi Lithos Nov 3 '15 at 17:23
• @CᴏɴᴏʀO'Bʀɪᴇɴ There! The carrot is back again in the third byte! – Kritixi Lithos Nov 3 '15 at 17:41

# JacobFck

JacobFck is a stack based esoteric language written in C#. It is capable of all basic operations as well as some more common operations. It is a slight mix of BrainFuck like syntax and Forth. The link above links to the JacobFck GitHub.

### Length 1

> 

This is one of the simplest instructions. It writes to the screen whatever is at the top of the stack.

### Length 2

^5 

The ^ instruction tells the interpreter that we are going to be pushing data (either number or register value) onto the stack. In this case, the number 5.

### Length 3

"s" 

Strings (encased in "") are automatically pushed to the top of the stack, and \n \t \r are all supported escape codes.

### Length 4

^2<+ 

This code would push 2 to the stack with the ^ instruction, push user input to the stack with the < instruction, and add the two together by popping them off the stack and pushing the result to the top.

## Length 5

:a<_a 

This code is an example of an infinite loop. :a declared the label a. < is the instruction to prompt the user for input. _a goes to the label a.

# Wierd

Factoid

Unlike other languages where the symbols in a program determine which instructions are executed, in Wierd, it is the bends in the chain of arbitrary symbols that determine which instructions are executed.

Chris Pressey created the angle-to-instruction mapping, and christened the entire mess "Wierd"--a cross between the words "weird" (which the language seemed to be) and "wired" (which would describe the appearance of programs written in the language)

You can try it online at http://catseye.tc/installation/Wierd_(John_Colagioia)

Length 1 Snippet

!


The actual character used doesn't matter - it can be any non whitespace character. This program doesn't do anything because there are no bends in the chain of characters - but there is a chain so at least it is a valid program.

Length 2 Snippet

++


Now we are going somewhere - we have a chain of characters. Still no bends so you wouldn't expect it to do anything but unintuitively this program does actually do something.

The current location starts in the top left corner facing "diagonally down and right". The current location always moves with inertia - it will move in the direction it is already moving until it can no longer do that and then will move in a direction closest to the current direction.

So the current location has to change 45 degrees so that it can continue to the right and that counts as a 45 degree bend so we push 1 onto the stack - exactly the same outcome as the Length 5 Snippet.

Length 3 Snippet

+
+


Same as the Length 2 Snippet this program does actually do something because the current location starts in the top left corner facing "diagonally down and right" and the current location has to change 315 degrees so that it can continue to the right and that counts as a 315 degree bend which will subtract the two items on the top of the stack. But there is nothing on the stack so the bend is a no-op and the program does nothing.

Length 4 Snippet

+
+


The current location starts in the top left corner facing "diagonally down and right" so there are no bends in this chain of characters and so this program doesn't do anything.

Length 4 Snippet

+
++


Finally a program with a bend! But it doesn't do anything useful :(

The current location starts in the top left corner facing "diagonally down and right". The current location always moves with inertia - it will move in the direction it is already moving until it can no longer do that and then will move in a direction closest to the current direction.

So the current location moves "diagonally down and right" and arrives at the next bend. It is a 225 degree bend so if the stack were to contain a zero it would push one character of standard input onto the stack and if it were a nonzero value then a value from the stack would be written to standard output. But there is nothing on the stack so the bend is a no-op.

Now the current location moves around the bend without doing anything, the current direction is towards the left and we are at another bend. This one is a 270 degree bend so if the stack were to contain a nonzero value the current direction would reverse. But there is nothing on the stack so the bend is a no-op.

Now the current location moves around the bend without doing anything, the current direction is up and we are at another bend. It is a 270 degree bend so if the stack were to contain a nonzero value the current direction would reverse. But there is nothing on the stack so the bend is a no-op.

Now the current location moves around the bend without doing anything, and we are in an infinite loop.

Length 5 Snippet

+
++


Finally a program that does something!

The current location starts in the top left corner facing "diagonally down and right" so the current location moves "diagonally down and right" and arrives at the next bend. It is a 45 degree bend so we push 1 onto the stack.

There are only four ways to get values onto the stack:

• Push a 1
• Subtract two values already on the stack
• Use a value on the stack to decide to read from standard input
• Use corordinates on the stack to read a value embedded in the program

So the only way to get a value onto an empty stack is to push a 1.

# GoLScript

## 5-vote

HAAZW


This is another simple program.

### Generation 0

H pushes 7, A pushes 0. Z is a fun command that pops Y, X and pushes the character at FIELD[Y][X], or (X,Y). In this case, the character at (0,0) is H, and so it's char code is pushed. W outputs this as a character.

The two outer-most cells die.

### Generation 1

We are left with AAZ, another call to Z, pushing h's char code to the stack (as the former H is now dead and thus lowercase). However, since the W died, it can no longer function, and thus, this phase ends.

Once again, the two outermost cells die.

### Generation 2

Now, only A is left, which carries out its duty in pushing a 0, and then dies. The program is effectively stopped.

## 4-vote

Bp
P


(newline counts as a character, iirc.) This does something rather simple:

1. The program is first BpP. This pushes 1 (B), pops a value (1) and assumes it p => P, and does that again, popping a zero from the bottom of the stack P => p.
1. Checking, only the new P survives, as it popped a value and lived. The rest of the characters died.
2. After, only the P remains; it pops an empty value (0) and dies.

## 3-vote

JXJ


First multi-step program! Here's what happens:

### Generation 0

The code is evaluated: J pushes 9 to the stack, X pops a number and prints it, and J again pushes 9 ot the stack.

The cells' live-states are updated. Both Js die, having only 1 neighbour. The X lives, as it has 2 neighbours.

### Generation 1

All that remains is the X. This prints the remaining 9 off the stack.

The X dies, and the program terminates.

### Final output

99


Hey, it's a start…

## 2-vote

@V


The shortest (?) still life in GoLScript. @ negates the top of the stack (effectively pushing true) and V reads the top of the stack, and dies if the value is falsey. Replacing @ with any of B-J would also produce a still life.

## 1-vote

X


Any 1-length program is valid. This one takes a zero of the stack (there is an infinite amount of zeroes atop the stack) and outputs it as a number.

## 0-vote (factoid)

GoLScript simulates Conway's Game of Life! Yay! Interpreter. You'll have to copy-paste the codes, and output is the bottom-most code block.

### Language information

• GoLScript is stack-based.
• GoLScript has no native string quoting!
• When will we run out of names beginning with Gol...? Gol><>, Golfscript, GoLScript, Golang (okay, not very golfy, but you get my point) :P – cat Apr 27 '16 at 22:43
• @cat upvote it if you like it ;) it's "Game of Life"... – Conor O'Brien Apr 27 '16 at 22:44
• I think you meant Game of Code Golf, since Code Golf is life... – cat Apr 27 '16 at 22:46
• @cat GOCG doesn't have as nice of a ring to it ^_^ – Conor O'Brien Apr 27 '16 at 22:47
• Add permalinks to the Interpreter – Cyoce Apr 30 '16 at 1:20

# Molecule

Factoid
Molecule is the descendent of Pylongolf2, a descendent of Pylongolf which was based on CJam.

0 byte snippet:




This does not do anything as it is empty.

1 byte snippet:

I


I read the input.
As Molecule outputs everything in the stack once the program shuts down, this makes a decent cat program.

2 byte snippet:

()


Anything between ( and ) is looped until ! is called.

3 byte snippet:

Inh


Read the input, convert it into a number.
The h converts numbers into characters.
So you can get some funky characters by using this.

4 byte snippet:

qn


Now here's where you could break the program.
Molecule has a built-in reflections system that allows you to modify the source code at runtime.
q Push the source code, n sets the source code to itself.
From v5.5, this snippet forces the interpreter to read from the start, creating a loop.

5 byte snippet:

0(1+~)


Have your program count until it reaches Infinity.. then it crashes.
(On my computer takes about 2 minutes to crash :P)

6 byte snippet:

u10000


It's interesting because putting a simple 10000 will push 1 and 5 zeroes to the stack, while the u keyword pushes the entire number after it.

• I can't wait for the 2 byte snippet! – CalculatorFeline Apr 25 '16 at 16:59

# Poslin

## Factoid

Poslin is a concatenative language with strict postfix notation and a metacircular interpreter.

It is similar to the language described in EWD28 in principle but is not inspired by it.

Unlike the language described in the linked paper, the immediateness of a symbol is definable in code, allowing the programmer to define almost arbitrary new syntax. Things like the symbol table and lexical environments exist as first class objects.

Every token in Poslin is surrounded by whitespace.

## Length 1 snippet

!


This is actually not a working program. Executing it in a fresh session gives a stack-bottom-error. This operation is immediate and executes the operation on top of the current stack. Without it, nothing would ever happen.

## Length 2 snippet

&+


This also isn't a working program. & is an immediate operation to compile something into a thread. &+ also is an immediate operation, but after compiling it executes the operation stored at a place accessible via HOOK compilation-hook slot-sub-get.

This way users can define their own optimization passes.

## Length 3 snippet

[ ]


This creates an empty stack. [] also creates an empty stack ad does so much more efficiently. That's because Poslin works with something which is called the path. The path is a stack of environments, where environments are kind of like prototyped objects, that is, they are mappings (from symbols to bindings) which can have parent-environments. When some object is found by the reader which is not an immediate symbol, it is put onto a stack which is saved in a binding (besides the path, the return stack and arguably streams the only mutable data structures in poslin) which is found under the symbol STACK in the environment on top of the path.

[ puts a new environment onto the path which contains a fresh binding containing an empty stack for it's STACK. ] pops the topmost environment off the path and then extracts the stack saved in the binding in its STACK slot.

[] just constantly returns an empty stack.

[], [ and ] are all immediate.

## Length 4 snippet

'& &


There is no single operation in poslin which defines a new operation. Well, actually there are several, but they're all defined in the standard library, which is written in a subset of poslin called "poslin0".

& has the purpose of transforming a given object into a thread.

For threads it's just an identity operation.

Symbols are looked up in an environment saved in a binding in the OP slot of the environment on top of the path.

Stacks are converted by turning everything but threads into constant functions returning that object and then concatenating together the resulting objects into one thread. At least, that's roughly how it works. This means, of course, that any operation which should be called inside a thread created this way needs to be turned into a thread via & before the calling thread is constructed.

Every other object is turned into a constant thread returning that exact object.

'& is special syntax: The leading ' tells the reader that this is a quotation, that is, everything after the ' is interpreted as a symbol (including any other 's) and then just put onto the current stack without checking for immediateness.

So the given snippet returns the thread of our poslin compiler. It is used in the operation ]o, which defines a new operation. With the knowledge given up to this point, you might be able to figure out how defining an operation works conceptually, even if you are missing some important operations.

## Length 5 snippet

$: ":  This is the string you'd normally see as "\"" in most other languages, that is, the string containing exactly the double-quote character. The character $ starts a delimited string. A delimited string has a delimiter, which is given between the $ and the next newline. The string contains all characters between that newline and the next occurence of the delimiter followed by some kind of whitespace. If the delimiter occurs and is not followed by whitespace, it is a part of the string and does not function as delimiter. Remember: Every token in Poslin is surrounded by whitespace. So, the given string could also be written as $"
""


or even """, as Poslin recognizes the usual syntax for strings, too. It does not recognize any escape sequences.

## Length 6 snippet

+ call


This is almost equivalent to + &. The important difference is that + & returns the thread of + while + call returns a thread which reads the binding which holds the definition of + and then calls the content of that binding. So, if you expect that the definition of + might change and you need to call the new definition instead of the old one, use + call.

This is necessary for defining recursive operations. There is no way to insert a thread into itself, so the binding which is later intended to contain the thread is inserted instead via call and after the thread is constructed it is written into that binding.

## Length 7 snippet

. ? ! !


? consumes the top three elements off the stack. The third from the top needs to be a boolean value. If it is true, the second from top is put back onto the stack, if it is false the first from top is put back onto the stack.

. is simply the no-op.

So this is an immediate when. Imagine the following stack:

[ 2 TRUE P{negation} ]


This proceeds as follows with the above sequence:

[ 2 TRUE P{negation} . ]
[ 2 TRUE P{negation} . ? ]
[ 2 P{negation} ]
[ -2 ]


Whereas if the stack is

[ 2 FALSE P{negation} ]


It proceeds thus:

[ 2 FALSE P{negation} . ]
[ 2 FALSE P{negation} . ? ]
[ 2 . ]
[ 2 ]


# Quetzalcoatl

### 6 snippet:

{c.I?}.

Makes a block with Code Snippet 4.

### 5 snippet:

{c.I}

Makes a code block, containing the code c.I. On snippet 8, we will use this.

### 4 snippet:

c.I?

Same as before, but also does power. Result is xth root of x.

### 3 snippet:

c.I

Outputs (input, 1/input) because I in 1/.

### 2 snippet:

c (or any token) + -q compiler flag

Proper quine. -q outputs source instead of running code.

### 1 snippet:

1 or (no code) + -n (1 byte).

Like in GolfScript, numbers just push their value. This outputs 1 because Quetzalcoatl implicitly prints the stack. This works for any digit 0-9. Second snippet outputs Quetzalcoatl, because -n outputs Quetzalcoatl.

### Interesting fact:

Quetzalcoatl got its name from the Aztec snake god (I wrote it).

• Is this meant to be a golfing language? – Cyoce Apr 9 '16 at 21:50
• @Cyoce This is a golfing language. – NoOneIsHere Apr 10 '16 at 15:37

# Coffeescript

## Description:

Coffeescript is a language that compiles into Javascript. It's much less verbose than JS (and about the same as ES6), which makes it friendlier for ing.

## Factoid:

Coffeescript doesn't require brackets with function calls.

## Length 1 Snippet:

=


The = sign means a lot of things in Coffeescript - it can assign both functions and variables in one fell swoop, much like Javascript.

## Length 2 Snippet:

**


This is the power sign, which is used like this: a**b. It replaces JS's Math.pow(a,b), which saves 11 bytes.

## Length 3 Snippet:

(n)


This is an argument in CoffeeScript, and is used like so:

{function name} = (arg1, arg2...) ->


(This is basically the same as JS, but I just wanted to show off functions - because they're so different).

## Length 4 Snippet:

0..5


For-loops are different in CoffeeScript. This snippet, when put into this context:

for a in[0..5]


Is the same as JavaScript's

for (a=0, a<5, a++)


and Python's

for a in range(5)


As you can see, this snippet shows the byte-saving powers of CS.

## Length 5 Snippet:

n=->1


Yay, a full function!

This snippet creates a function, n, with no arguments, which outputs 1.

## Length 6 Snippet:

if n<1


This is an if statement, in CS. Notice the lack of a colon, or curly brackets (yes, no curly brackets!). This compares n, and checks if it's less than 1.

Simple enough.

## Length 7 Snippet:

class A


This is a class declaration in CoffeeScript. Despite there being no support for classes in JavaScript, there's classes in CS - and they work exactly the way you expect them to.

• That = declaring functions sounds bad to me. I would say, it is another case when a value is assigned to a variable, just the value is not number or string, but an anonymous function. – manatwork Aug 11 '16 at 11:15
• Math.power don't exists; the correct function is Math.pow – TuxCrafting Sep 7 '16 at 8:48

## Pip

An imperative golfing language with infix operators, with commands in printable ASCII. While these design decisions mean that Pip will probably never beat Jelly in a golf contest, they also make the language much easier to learn and use.

### Factoid

To my knowledge, Pip was the first golfing language to have built-in regex support.

### Length 1

a


Pip's default method of getting input is by command-line arguments (hereinafter "cmdline args"). The first five args are assigned to the variables a through e, and the whole list is assigned to g.

Since it is at the end of the program, the expression a is auto-printed. So this program outputs the first cmdline arg.

### Length 2

/q


To get input from stdin, use the q special variable. Every time it is referenced, it reads a line of input.

Many operators have both binary and unary versions. This is expected behavior for operators like -, and makes good sense for others like ^ split and J join. Here we have a somewhat unusual example: unary / inverts its argument. Inputting 4 will give 0.25 as output, and vice versa.

This snippet also demonstrates a feature that Pip shares with Perl and PHP: numbers are strings and strings are numbers. Both are represented by a data type called Scalar. Upshot: you don't have to convert q's line of input to a number before doing math with it.

But what happens if you input something that's not a number, like Hello world? In a numeric context, it's treated as 0. Dividing by 0, like most error conditions, returns the special nil value, which produces no output when printed. If you want to see what went wrong, you can use the -w flag to enable warnings, in which case Pip will tell you:

Inverting zero


### Length 3

Uses the -p flag (+1 byte).

^g


As mentioned above, g is a list of all cmdline args. Many operators work itemwise on lists, and ^ (split) is one of them. This code splits the items of g into lists of characters.

If you ran this 2-byte code without the flag, it wouldn't be obvious what the program did, because Pip's default way of outputting lists is to concatenate the items together. To demonstrate that the split operation worked, we need to change the output format. About half of Pip's command-line flags have to do with list formatting. The -p flag applies RP (analogous to Python's repr) to the list before outputting it, making it easy to see the structure:

> python pip.py -pe "^g" 42 Hello
[[4;2];["H";"e";"l";"l";"o"]]


Use the TIO link above to play around with the other list flags (-s, -n, -l, -P, -S) and see how the output changes.

### Length 4

z@<h


Lowercase letters h through z are global variables, preinitialized to different values. z is the lowercase alphabet; h is 100.

The @< "left-of" operator returns a slice from the left end of an iterable (scalar, list, or range). It's equivalent to Python iterable[:index]--except that the Pip version works even when the index is greater than the length of the iterable. In that case it repeats the iterable until it's longer than the index, then takes the slice (like take + cycle in Haskell). So z@<h gives the first 100 characters of the lowercase alphabet:

abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuv


### Length 5

2>1>0


Comparison operators chain, as in Python. This program returns 1 (true).

# hansl

hansl is a programming language that is used in the statistical software project gretl since 2001. It resembles a mixture of R, Stata, and C. It operates with datasets, time series, vectors, matrices, and functions. Just as in R, there are dozens of user-written packages for econometrics and data analysis. It is a matrix-oriented interpreted language that is Turing-complete (!). Its fortes are econometric estimation and numerical maximisation, and it can be integrated with R, Ox, Octave, Stata, Python, Julia, and gnuplot.

### Length 1 snippet

~


You know how difficult it can be to build matrices from vectors? One can attain the effect by reading the input row-wise, column-wise, or through assembling the mess into a dataset? In hansl, you do not hassle: just write ~ between the two vectors, and voila, you get them bound in tight leather together vertically: A~B. Do you have two matrices you want to assemble? X~Y, easy as pie.

### Length 3

>}+


Explanation:

>   Turn the cursor 90° to the right
+ Increment the pointed cell


So the memory after this is:

0
1


This demonstrate D2's 2D tape

### Length 4

+\$}^


This set the first cell of the tape to 1`, put the value in the register, advance one cell and put the value of the register in the cell.