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

# Factor

Factor is a concatenative, stack-oriented and object-functional programming language first developed by Slava Pestov in 2003 as a scripting language for a game engine. Factor unites the simplicity and durability of Forth's stack-procedural paradigm and extensible word-based syntax, with the applicative, point-free and functional styles of Joy and Lisp.

In Factor, whitespace is the apply operator, the default operation. All words are first class objects; in fact, almost everything is a first-class object which means tons of possibility for extensible syntax, new types and literals, and all the other awesomeness introduced by Homoiconicity.

Unlike Forth, Factor prefers to use the many, many different higher-order words at its disposal over shuffle words, which should be avoided for the sake of readability and idiomaticity.

Oh, its documentation is amazing, and the Listener UI / IDE (written in pure Factor) has the documentation offline and searchable. :D

I mentioned above that Factor was a scripting language -- that was back when it ran on the JVM, too. Factor, its runtime and its optimising native-code compiler are 97% pure Factor, with just 3% being low-level C++ for the VM and bootstrap.

I guess we'll go top-to-bottom, Iunno.

### Length 1

For length 1, let's start at the most basic building block of Factor: the word that lets us make more words.

Factor's pretty verbose so there's not much to do with one byte, because the "words" are literally words, and there's a lot of whitespace everywhere.

This means the fun in golfing comes not from shortening identifiers, but from re-Factoring, which is where Factor gets its name. :D

Factor gets a lot of its pleasant syntax from Forth. The simplest flavour of word-definition word, : is an example.

Use it like:

: word-name ( input -- output ) word-body ;


The word will then be callable by word-name, and word-body will execute, taking and putting things to and from the stack. word-name's stack effect must match its actual effect on the stack. If add takes two numbers from the stack and adds them together, leaving the result on the stack,

: add ( a b -- x ) + ;


Then its stack effect is that of the only word in its body (part of the power of concatenative languages). The identifiers in the effect don't matter, just that they are a proper representation.

### Length 2

Another word-definition word, ::, allows the use of the :> lexical-variable-binding word, and causes inputs to be bound to the names in the stack effect.

:: join-strings ( a b -- x ) a b suffix! ;


To bind a value to a name:

:: var-demo ( a b c -- ) a c + b * sqrt :> val ;


val goes out of scope when the word is done executing.

### Length 3

[ ]


Here, I'll let you have a guess at what this is. Hint: It's not an array.

You don't know? It's a quotation -- it allows putting an executable block of literal code on the stack, that the higher-order functional and applicative words can manipulate.

Brackets for blocks come from Smalltalk syntax (with the locals vocabulary you also get [| param | code ] which kind of resembles Smalltalk's [ :param | code ]).

### Length 4

I'll try to do something more interesting this time, as fede s. suggested in the comments:

2bi@


Before I explain what this is, I should probably first explain something about Factor identifiers.

A valid Factor identifier is any string which matches the following:

^[^"][^\s]+$ Yes, that's it. Any identifier can contain any character that isn't whitespace, and it can't begin with one or more "s, because strings are special to the lexer. It can have " elsewhere within it, though. The NUL byte, the character at UTF8 888 and the byte at 127, ASCII DEL are all valid identifiers. For portability, sometimes SYMBOLs may be stripped of their non-ASCII bytes (Windows, for instance). This may be rather shocking to the C people and the Python people (and even the Lisp people, who allow some nice stuff in names), but fear not, for you will come to like it. So 2bi@ is just one identifier, one name for one function. But what does it do? Well, the bi@ function applies one quotation to two items on the stack: "5" "10" [ string>number ] bi@ --- Data stack: 5 10  (bi stands for bifurcate, if you were curious.) "5" "10" "15" "20" [ append string>number ] 2bi@ --- Data stack: 510 1520  2bi@, like 2map, takes a quotation with stack effect ( obj1 obj2 -- ... ), which gets applied first to w and x, then y and z in pairs. ### Length 5 Finally, a word for working with sequences. Factor is no APL / J / K / Octave / what have you, but its array processing skills are... close... kinda. union  If you're familar with Python (like I am), then you may recognise this better as the | operator on sets: { 1 2 3 } { 2 3 4 } union --- Data stack: { 1 2 3 4 }  Removes duplicates while performing element-wise OR. Technically, the union word is from the sets vocabulary and not the sequences vocab. This is because, like Python, sets are special, super-fast immutable sequences that don't allow duplicate entries. Also much like Python, any sequence (byte vector, hashtable, set, etc) that implements the Sequence protocol (__iter__ being the equivalent in Python) is considered fair game and supports a well-defined set (hah) of operations, so any word that works on a generic sequence A will also work on a generic set B if both have the right method dispatch. ### Length 6 Ooh, more arrays! (Note that arrays are immutable; all operations on them yield new arrays and the old ones are GC'd. Vectors are mutable and slower, but we'll cross that bridge when we get there.) 2array  This is a highly useful word. Any guess at what it does? Here: IN: scratchpad 1 2 2array --- Data stack: { 1 2 } IN: scratchpad { 3 4 } 2array --- Data stack: { { 1 2 } { 3 4 } }  Well shucks, it takes two things off the stack and makes a new array from them. 1array, 3array and 4array all do exactly what you'd expect, and narray takes an arbitrary n argument, to avoid messy concatenation code. If I may digress yet again about naming... In Java or Python, one might call this function values2array or valuesToArray or even values2Array. However, here in Factor-land, we have some conventions. Remember my spiel about identifiers? Numeric digits in names should only be used for indicating real numbers or counts of things; in particular, this means 2array should not be read as to-array but as two-array. The word which does to-array is called >array. The word which turns a number to a string is number>string, and the word which turns an object's slots to an array is tuple>array. See a pattern? Hmm. Users of Racket will feel right at home with these sorts of names, since Racket uses stuff like number->string. • @fedes. Done! Have a suggestion for #5? You can even edit it in yourself; I'll make sure to accept it :P – cat Apr 27 '16 at 22:36 • On the naming conventions and Racket (actually from scheme), there's also - for separating words (map-index), ! for mutators (union!) and ? for predicates and tests (odd?)! Good choice IMHO :D – fede s. Apr 28 '16 at 2:29 • Why did someone just downvote this?? – cat Apr 28 '16 at 17:11 • Also WTF w/downvote? Someone pushing another language higher? ಠ~ಠ – fede s. May 1 '16 at 4:24 • You owe us a few more snippets! – bkul Jun 27 '16 at 0:11 # JSFuck ## Length 5 +!+[]  As mentioned before (in the length 4 section), !+[] produces true. Also, as mentioned before (in the length 1 section), + can cast to number. Therefore, this code casts true to number, which is 1. This snippet can be chained indefinitely to produce any number you want. For example, 2 would be +!+[]+!+[], and 3 would be +!+[]+!+[]+!+[]. As mentioned before (in the length 4 section), +!![] is also valid. ## Length 4 !+[]  The operation ! casts to boolean. The number 0, the empty string "", the undefined, and the NaN are all treated as false. Other objects are treated as true. Unlike Python, the empty array [] and the empty object literal {} are treated as true. Therefore, this is the shortest snippet to produce true. It is equivalent to !0. !![] would also work. ## Length 3 +[]  As mentioned before, + casts to integer. In this case, it would be evaluated to 0. However, also as mentioned before, + can join two arrays to form a string. Therefore, +[]+[] is really 0+[] which would produce "0". ## Length 2 ++  There are really only 36 length-2 snippets. Out of the 36 snippets, I chose this one. This is the shortest way to add 1 to a number. This function is very strange. For example, v=1; ++v works, but ++1 does not. For example, v=[]; ++v also works (empty array [] is implicitly cast to 0), but ++[] does not. To make it work in JSFuck, you would have to type ++[[]][+[]] instead. [[]][+[]] is really [[]][0], which is an empty array []. Why ++[[]][+[]] works but not ++[] is yeond me. ## Length 1 +  + can convert a string to a number, as well as adding two arrays together to form a string. For example, +"0" would result in the number 0, and [1]+[0] will result in the string "10". ## Factoid All JSFuck programs are valid Javascript programs. However, JSFuck aims to use only 6 operators to do everything: +![](). Also, its name is derived from JS (javascript) and Brainfuck. Brainfuck only uses 8 operators. • It's not strange; increment only works on variables. – ASCII-only May 24 '16 at 13:34 • Why is [[]][+[]] a variable but not []? – Leaky Nun May 24 '16 at 13:36 • @LeakyNun I'm guessing there, but isn't [[]][+[]] technichally the value in an array's cell? hence, it's technichally a variable, alllowing to increment it. – Katenkyo May 24 '16 at 13:40 • @Katenkyo Thanks, but I still don't get it. What is [] then? – Leaky Nun May 24 '16 at 13:47 • @LeakyNun it is an array in itself, in some cases JS will allow you to use it as a pointer to its first value in the second case, you get an empty array, yes, but it is interpreted as a value as it is inside an other array -> [[]][0] vs []. In first case you have the value of an array wich is considered a variable of type "array", in the second one, you manipulate an array. – Katenkyo May 24 '16 at 13:53 # The Hexadecimal Stacking Pseudo-Assembly Language Alright, this is one of the several languages I've designed myself, and one of the only two three that has been implemented thus far. The program is represented as a list of 6-digit base-16 unsigned integers. Line breaks between them are optional, but not required. All other whitespace is forbidden. It is intended to resemble a form of bytecode, even though, in reality, it isn't one. Its lack of readability may well make it a Turing Tarpit, despite the fact that it has more features than most Turing Tarpits. Edit: It has been suggested that I score each hexit/nybble as half a byte. I think this is reasonable, so I'll go with it. Therefore: Length 1 snippet: 11 A command that takes a number from input. Another four hexits are required to make it syntactically valid, the next two provide a stack address and the last two are ignored. Length 3 snippet: 110000 Takes a number from the input and pushes it to stack 00, the last two hexits are ignored but are required for the command to be syntactically valid. Length 6 snippet: 400000400100 Pushes a zero to stack 00, and then another zero to 01. When using the first two stacks as a tape (and the third for scratch work) this is how you would initialize it at the beginning of the program, pushing a zero to stack 00, then another zero to stack 01. Length 9 snippet: 200001400000210000 In the Brainf*** equivalence described in the documentation, this is the substitution given for the + instruction. It creates the constant 1, pushes it to stack 00, then pops the top two values of stack 00 and pushes their sum. +, ., and , have the three shortest substitutions given. • Not sure if this applies, but if we're going by entropy, we would score a length-6 hex entry as 3 bytes as in meta.codegolf.stackexchange.com/questions/546/… – lirtosiast Jun 6 '15 at 23:43 • So... should we do that for this? – SuperJedi224 Jun 7 '15 at 1:47 • It's your choice I think; the brainfuck answer scores by characters but since this is literally hex you could score by entropy. – lirtosiast Jun 7 '15 at 2:29 # Thue Thue (the correct pronounciation is either "TOO-eh" or "TOO-ay", I've heard both) is a language based on nondeterministic string rewriting. It is presumably named after Norwegian mathematitcian Axel Thue. A program consists of a list of zero or more substitution rules (terminated by the null rule), followed by a string indicating the initial state. Length 1: ~ Prepending a tilde to the right side of a rule is the language's only way to produce output. Basically, when that rule is applied, the target substring, instead of being replaced with the string on the right side of the rule, is removed and the remainder of the string (everything after the ~) on the right side of the rule is printed to the output. (A rule may be applied to any substring of the state which matches the rule's left side.) When used in this way, a tilde is often read as "print". Length 3: ::= These three characters (typically read as "can mean") are used to separate the left side of a rule from the right side. When both sides of a rule are empty, it serves as the null rule, which terminates the rule list (what should happen when only the left side is empty is undefined, most implementations treat it as equivalent to both sides being empty. It is, however, perfectly valid for only the right side to be empty.) Length 4: 0::= This is a complete rule dictating that instances of the substring "0" may be removed and discarded. Length 5: 0::=0 This is a complete rule dictating that instances of the substring "0" may be replaced with... itself. This can be used to construct a simple infinite loop, as seen here. Length 6: ab::=~ This is a complete rule dictating that instances of the substring "ab" may be removed, printing the empty string. As the specs don't actually provide any way of printing a newline, some implementations will do this when the empty string is printed. Length 7: a::=::: When three colons are used as the right side of a rule, this means the replacement string should be taken from STDIN. Thus, this rule dictates that instances of the substring "a" can be replaced with strings from STDIN. Triple colons used in this way are read as "input". # Tcl See also this answer. ### Factoid In Tcl eval is not evil in most cases. And you can implement your own control structures using eval. ### Length 1 h  If you run tclsh interactively, you need only to write the initial characters of a command, if it is not ambiguous. In this case, there is only one command history beginning with h. So it will print the command history, which is like this:  1 h  If you try a instead, it will print something like this: ambiguous command name "a": after append apply array auto_execok auto_import auto_load auto_load_index auto_qualify  ### Length 2 []  It's the empty string, just like "" and {}, but works differently. It executes the commands in the brackets, which are nothing, and substitute the result of the last command, which is empty. The empty string is also a prefix of every command. So if you type [] directly in tclsh, you can get a list of all available commands while it complains that the empty string is ambiguous. ### Length 3 end  Used in lindex, lrange, string index, string range, etc. While most languages require an extra operation to get the length of a string/list to specify a position at the end of the string, Tcl simply uses end. You can also use end-k where k is an integer, to make it more useful. ### Length 4 "\{"  The string {. You can also use "{", but that will cause you some trouble. The bodies of control structures in Tcl are parsed as strings, and the closing brace in the following code: if 1 {puts "{"}  will match the opening brace in the "{". So this code is an incomplete statement. You have to add another } to end the if statement. You can escape the { to get rid of this problem. But of course, if your braces in the string are matched, you don't have to do anything. You can also make braces in different strings matched, which is still valid but may make the code less maintainable. ### Length 5 {a b}  A list. Or just a whitespace-separated string. In case an element contains whitespaces or other special characters, they could be quoted using {} (which cannot contain unbalanced braces) or "" (for whitespaces) or escaped using \. "" and \ can be combined together. There are many commands working with lists. Basic ones are list, to generate a list from elements, and lindex, to get an element from a list. ### Length 6 \{{}\}  Well, I can't think of a good one with length 6. So here is something random. Apparently Tcl checks only the first character in a word to decide whether it is the beginning of a {} quoted string. So you only have to escape the first { if it is not. Better also escape a matching } to make it matched for the reason described in the length 4 snippet. ### Length 7 $a(a b)


Tcl also supports arrays, which are faster for random access than lists. The grammar for accessing an array is $name(index). So there isn't such a thing as multidimensional array. What would you do if you need it to be multidimensional? Well, one way is to use a list as its index, as shown in this example. Note that the braces in {a b} are quotes of a string and not a part of the list itself, which are not used in the array access grammar. And make sure the list is in the canonical form generated using the list command if you do it this way. It's not only for array indices. Variable names and even procedure names could also contain spaces or be empty. After writing this I realized that it isn't as perfect as I thought. Normal variable names cannot both contain any ( and end with a ). And array names cannot contain any (. It's also a bit more difficult to access a variable with } in its name, or an array with special characters in its name and also use lists as its index. ### Length 8 if 0 [a]  a is executed before the if condition. If the condition is true, the result of a is parsed as commands and executed afterward. But a is always executed. I think I saw this used some times in the old underhanded or popcon questions. • 'eval is not evil' :) nice pun! – sergiol Mar 12 '17 at 22:54 # Cy Cy is a postfix language that operates on a stack. Cy is meant to be somewhat-practical, meaning I do things like use actual words and have insignificant white space, in sharp contrast with my previous languages. If I explain things poorly or you want to try it yourself, feel free to install the Ruby interpreter I will be using the following format in examples (this is the format used by the Ruby interpreter's REPL (accessible via the -r parameter (ooh nested parentheticals! I should try lisp next!))): >>> :: [initial stack] >>> some code :: [resulting stack] >>> some more code :: [resulting stack]  ## Factoid The order in which operands are expected on the stack is based not on what makes sense, but the order in which it would be most convenient to pass on arguments in a tacit style, i.e. taking arguments in the same order as they would most likely be passed to a user-defined function. More on this later. ## Length 1 Snippet 1  This pushes the number 1 to the stack. Example: >>> :: [] >>> 1 :: [1]  ## Length 2 Snippet $x


This pushes the value stored in the variable x to the stack. Assigning values to variables is covered below.

## Length 3 Snippet

"a"


This pushes the string "a" to the stack. Pretty self-explanatory. Note that single quotes ' cannot be used for this purpose.

Example:

>>> "a" # string
:: ["a"]

>>> 'a' # error
Error
@ 'a'


## Length 4 Snippet

tran


tran is an incredibly useful built-in I just implemented. This operator is used to define a stack transformation. It takes two arrays describing the old and new state of the stack. The second array should be a shuffled version of the first, and the stack will be modified accordingly.

Example:

>>>
:: [1, 2, 3, 4]

>>> [.a, .b] [.b, .a] tran
:: [1, 2, 4, 3]

>>> [1, 2] [2, 1, 2] tran
:: [1, 2, 3, 4, 3]


## Length 5 Snippet

10 =x


This is the syntax for setting variable x. Note that the = sign has to be touching the identifier; 10 = x would do something different.

## Length 6 Snippet

&print


Now we get into the interesting stuff. print is a function that pops something from the stack and outputs it. & is a prefix that makes its function peek from the stack instead of popping it. This means that the top of the stack will be outputted, but still left on the stack.

## Length 7 Snippet

{10} if


This showcases two things - blocks and if-statements. A block holds a piece of code. The block {10} is a block that pushes 10 to the stack. The if command pops a value from the stack, and if it is truthy, executes the given block. In this case, it would push 10 to the stack.

Example

>>>
:: [0]

>>> {10} if
:: []


>>>
:: [1]

>>> {10} if
:: [10]


# Length 8 Snippet

{3 2 ^-}


This demonstrates another modifier, related to &. Without the ^, the block {3 2 -} would just push the difference of 3 and 2 (1). However, the ^ in front of - makes it do something special. If the block is called with an &, it will execute &- (peek for operands); if not, it will execute - (pop the operands).

Example

>>> {3 2 ^-} =f
:: []

>>> f
:: [1]

>>> &f
:: [1, 3, 2, 1]

• 5 votes--how to assign a variable? :3 – Conor O'Brien May 4 '16 at 13:43
• @CᴏɴᴏʀO'Bʀɪᴇɴ read on and find out! – Cyoce May 4 '16 at 15:25
• What would 0=x do? – Conor O'Brien May 4 '16 at 15:30
• @CᴏɴᴏʀO'Bʀɪᴇɴ that would push 0 to the stack, but that's just a quirk of Ruby number parsing. – Cyoce May 4 '16 at 16:21

# Pascal

Factoid : Pascal programming language is a very old programming language which is invented in 1970 (2 years older than C) by Professor Niklaus Wirth . Original Pascal is procedural .

Because of its easy syntax and perfect efficiency , many programs have been made using Pascal . some examples are :TeX - Apple Lisa - Total Commender - Skype

Major Implementations are : Gnu Pascal - Free Pascal - Turbo Pascal - Borland Pascal

## Length 1 snippet :

.


This is a dot ! Any pascal program must end with "." even if it is possible to be terminated in the middle . This dot is usually written after an end . To terminate the program somewhere at the middle of execution , you need to use halt command

;


This is not a snippet , I've just mentioned it for its importance . this is an empty statement . It is so important to use it in right place . You must put this at the end of almost "every" command . but there are some execptions too . for example :

...
IF (x<=y) THEN HALT
...


is different from :

...
IF (x<=y) THEN HALT ;
...


We'll see this difference later .

## Length 3 snippet :

END


This is a reserved word in Pascal . Pascal is a block-structured language - like C - which means a program is separated to blocks , and each block may be separated to some smaller blocks and so on . each block contains some statements . In Pascal , Blocks start with BEGIN and end with END (like { and } in C) . Main program is ended with END. and all the sub-programs (like functions , programmer-made procedure etc) are ended with END;.

## Length 7 snippet:

PROGRAM

Sorry for the delay, fans! So, this is a PROGRAM! Every program must start with PROGRAM <name>;, where <name> is your program's name. Every program must have a "main block", which is a part of code between BEGIN & END which is not related to any other parts of code (e.g. it's not a function's definition) & program's execution starts from there.

• “Any pascal program must end with "."” – Not only programs, but units too. “This dot is usually followed by an end.” Never seen a . followed by end, only the reverse. Then end. can be followed by any blah-blah, as it is ignored by compiler. – manatwork Jun 24 '16 at 12:56
• @manatwork units are not in original pascal and it was first intented in turbo pascal . Also thanks for mentioning that mistake , i'll fix it now – user55673 Jun 24 '16 at 13:14
• Oh, so the modern implementations are only mentioned without being compatible with the snippets/explanations. My mistake. (BTW, you misspelled “Borland”.) – manatwork Jun 24 '16 at 13:37

# eacal

## 0-vote

eacal is a language made by me in 2016. It's very extremely verbose, but, as I hope, is capable. There is one command per line, and each data entry is separated by spaces. It is meant to be classified under a lot of programming paradigms, which includes right now, imperative, structured, stack-based, object oriented, event-driven, and a tad of functional.

Fun fact: the empty program errors.

## 1-vote

v


This prints:

eacal is currently running.


This tells you if eacal is still alive. Helpful!

## 2-vote

on


This is the event-driven portion of eacal. It's syntax is:

on <event> <code evaluating to a function>


Here is an example:

on end eval print string Done!

print string Running...


This prints:

Running...
Done!


## 3-vote

arg


This returns all of the command-line arguments passed to the program. Like so:

node eacal.js <file> 3 4 Hello


File:

print arg


Output:

[ '3', '4', 'Hello' ]


## 4-vote

init


This is used to initialize stacks, like so:

init main


Otherwise, the stack does not exist.

## 5-vote

alias


This sets creates a command that function the same as another command. Example:

alias define_stack init
define_stack main


is the same as

init main


This is very helpful in golfing.

## 6-vote

string


Represents a string, where it's arguments are joined by spaces. So, Hello, World! is this:

string Hello, World!


## 7-vote

numlist


This returns an array of numbers representative of its arguments. For the first few Fibonacci numbers in a list:

numlist 0 1 1 2 3 5 8 13 21


## 8-vote

func add


This shows some of eacal's function programming. You can execute it on a stack named k using exec k--func add. For example:

init main
push main number 5
push main number 8
; outputs 13


## Oasis

### Factoid

You can try it online here.

### Length 1

n


Not very interesting, just push n (The current argument) and print it because implicit output.

### Length 2

n1


Same as the previous snippet, but give 1 for the argument 0.

Oasis programs can have a list of hardcoded definitions for special cases.

So n1 can be described in pseudocode as:

A(n) = n
A(0) = 1


Special cases and indexes are reversed, so to make

A(0) = 1
A(1) = 4


The correct special cases definition is 41

As @Adnan pointed it out, another interesting snippet is the fibonnaci sequence:

+T


Because T is replaced with 10, so this is expanded to

+10


Which mean

A(n) = A(n - 1) + A(n - 2)
A(0) = 0
A(1) = 1


### Length 3

n*1


Finally, an useful snippet!

This calculate a factorial.

     A(n) = n * A(n - 1)
n    Push n
*   Multiply two items on the stack
Because there is only one item on the stack, A(n-1) is pushed
1  A(0) = 1


### Length 4

n*x1


Showcase the command x (Double a number).

This is basically a factorial, but double the number returned by n*A(n-1).

A(n) = n * A(n - 1) * 2
A(0) = 1


### Length 5

Tnm>1


Calculate A000533

       A(n) = 10^n + 1
T      Push 10
n     Push n
m    Power
>   Increment
1  A(0) = 1


### Length 6

Tnm<9÷


A002275 aka repunits

        A(n) = (10^n - 1) / 9
T       Push 10
n      Push n
m     Power
<    Decrement
9   Push 9
÷  Floor divide

• Another interesting 2 byte submission is +T, which is the Fibonacci sequence :). – Adnan Nov 12 '16 at 18:46
• You can also add a Length 6 snippet. – Erik the Outgolfer Nov 13 '16 at 10:45

# Casio-BASIC

Casio BASIC is very unlike TI-BASIC; firstly, it doesn't require as much RAM, memory or power. Programs typically only use a few KB of RAM. Secondly, it allows scrolling through the list of functions to write a program, or the use of special buttons which insert common characters. However, unlike TI-BASIC, functions can simply be typed in letter by letter from the keyboard.

## Length 8 snippet

Print 9!


This prints 9 factorial, which is 362880.

## Length 9 snippet

Print n+n


Even though we didn't define n, the calculator doesn't throw an error. Instead, it treats n as an expression, and prints out 2·n. (A floating dot is used by the calculator to represent multiplication)

## Length 13 snippet

DrawGraph x^2


Opens an empty graph plane, and draws the graph of y=x^2 onto it.

## Length 15 snippet

seq(x^2,x,1,10)


This will print x^2 for all values of x between 1 and 10.

• Is it suited for golfing? – lirtosiast Aug 29 '15 at 4:59
• It probably isn't. – georgeunix Aug 29 '15 at 5:25
• Add some snipits? – Conor O'Brien Oct 5 '15 at 20:44

# Scratch

Factoid: Scratch has a great appeal to younger audiences, with the large majority of new accounts being from 10 to 16 years old.

### 1 byte

The say block takes what is in the text space and outputs it as a text bubble.

### 2 bytes

The when green flag clicked block is essential for most programs. The stop [all/this script/other scripts in sprite] block does exactly what it says, but it isn't used much in optimized scripts.

• The highest-ranked scoring rule you linked to scores the say block as four bytes say( plus the contents. – Not that Charles May 25 '16 at 18:41
• Although since it does not specify a human-language for scratchBlock output, you can also use decir( or 说( or lots of other options... – Not that Charles May 25 '16 at 18:44
• I'm going off the main post, not the responses. – weatherman115 May 25 '16 at 18:55
• ... but that's not how meta works. However, it makes sense to use "each block is one vote" for the purposes here. – Not that Charles May 25 '16 at 19:45
• And each character of text in text spaces is one vote. Don't forget about that. – weatherman115 May 26 '16 at 16:23

# O

## Factoid

O is a programming language inspired by GolfScript, Pyth, K, and tons of other languages. It was made by Phase (me) over the summer of 2015, so it is relatively new. The interpreter was originally written in Java, but development has recently switched to a C interpreter. Here are some examples of the language.

# Length 5

'69+o

This programs prints 69.

• '6 pushes 6 as a string
• ' pushes the next character in the program as a string to the stack
• 6 is the next character, so it gets pushes as a string
• 9 pushes the number 9 to the stack
• + adds the top two elements of the stack. Since of them is a string, they get concatenated.
• o outputs the result

# Length 4

M]+o

This program gets the sum of all the digits of the input number. (1234 = 1 + 2 + 3 + 4 = 10)

• M is a builtin macro that calls [i~.
• [ Starts an array (which really acts like another stack)
• i Gets an input from stdin and pushes it to the stack (the array in this case)
• ~ Evaluates the top of the stack (the input) as O code, which pushes each digit of the input number to the stack.
• ] Closes the array, pushes it to the stack
• + Folds the array by adding all the elements together
• o Outputs the sum of the digits to stdout.

It's a pretty complicated program for only being 4 bytes!

## Length 3

{1}

O supports CodeBlocks like GolfScript and CJam. This is a CodeBlock that pushes the number 1 to the stack when it is run. Just creating a CodeBlock pushes the block itself to the stack, without running it. We could assign it to a variable, or use ~ to run it.

## Length 2

Ao

A pushes 10 to the stack. o pops the top of the stack and outputs it to STDOUT. This program outputs 10 to the screen.

## Length 1

1

Any number literal will be pushed to the stack as an integer. The stack is not outputted when the code ends (though this may change soon!), so the program exits without outputting anything.

# ShapeScript

### Length 6 snippet

"%c"@%


ShapeScript has no type casts, but Python's % can be used to work around this limitation. This snippet, e.g., pops an integer from the stack and pushes the singleton string of the corresponding Unicode character in return.

### Length 5 snippet

'"A"'


This is a string that, when evaluated, pushes the singleton string A on the stack. There is no way to escape a quote in ShapeScript, so two different kinds of quotes are required to use strings in evaluated strings.

### Length 4 snippet

01-?


This calculates -1 and then pushes a copy (?) of the bottom-most item on top of the stack. Since there are no variables, leaving things on the bottom to access them later is a common technique.

### Length 3 snippet

123


Despite what it may look like, this actually pushes three integers on the stack. Any integer above 9 or below 0 has to be pushed as angebraic sum of products of integers.

### Length 2 snippet

*!


With a Boolean and a string on the stack, * pushes the unmodified string for True and and empty string for False, which ! then evaluates. This is the closest ShapeScript has to a conditional operator.

### Length 1 snippet

!


Discounting that it can no longer take input, this is a fully compliant ShapeScript interpreter.

### Factoid

I created ShapeScript as one half of my submission to Create a programming language that only appears to be unusable as a simple, stack-based language with a simple syntax.

While ShapeScript is far from unusable, it does not have traditional loops, conditionals or variables, can modify only the two topmost stack items, can modify strings only using split and join, etc.

# TurtleGolf

Kind of a shameless plug, but I present to you my very very first language!

It's a simple stack-based language designed to let people make shorter turtle programs.

Factoid

The stack is pre-populated with five zeroes, use this to your advantage in !

Length 1
;
Every single line of code in this language is a loop that will run until the pointer reaches a ;. When the pointer reaches this command, it will break the loop and go to the next line.

Length 2
f^
Yay, two new things! The command f pushes the number 15 onto the stack, and the ^ command pops the top value from the stack and moves forward by that amount in pixels. Too bad we don't have enough room for a ;, so this turtle is going to move forward forever.

Example

The stack during execution:

[0,0,0,0,0]      start
[0,0,0,0,0,15]   f
[0,0,0,0,0]      ^
[0,0,0,0,0,15]   f
[0,0,0,0,0]      ^
etc.


Length 3 snippet
)?;
Finally an if-statement! ) pops two values from the stack and checks if one of them is greater than the first. (It pops X and Y, and checks if Y > X) If that's the case, 1 is pushed on the stack. ? pops one value from the stack and checks if it's zero or non-zero. If it's zero, skip the next command (In this case it's the ';', which terminates the line). Otherwise, run the next command.

Example

The stack before execution:

[0,0,0,0,0,5,2]


The stack during execution:

[0,0,0,0,0]    ) pops the 5 and the 2 to check if 5 > 2.
[0,0,0,0,0,1]  5 > 2, so push 1.
[0,0,0,0,0]    Pop the value so ? can check if it's zero.
[0,0,0,0,0]    It is not zero, so execute the next command, which terminates the line.


Length 4 snippet
12+f

You can use the + - * and / commands to add, subtract, multiply or divide the top two numbers of the stack.

The stack during execution:

[0,0,0,0,0]      Start
[0,0,0,0,0,1]    1 pushes 1 on the stack
[0,0,0,0,0,1,2]  2 pushes 2 on the stack
[0,0,0,0,0,3]    + pushes (1+2=)3 on the stack
[0,0,0,0,0]      f moves the turtle forward by 3 pixels.


# Hassium

Hassium is an object oriented programming language in C#. It contains many of the exact C# classes and over 400 functions built in. You can run Hassium code and examples here.

## Length 1

5


This is a constant integer in Hassium.

## Length 2

a:


This is a label in Hassium. Hassium supports labels and gotos as well as all types of loops.

## Length 3

m()


This is a call to a function called m in Hassium.

## Length 4

a=4;


This is declaring the variable a with the initial value of 4. In Hassium you don't have to declare the type of variable like int a=4;

## Length 5

a=[];


This declares a new array in Hassium, where arrays are Javascript and python like. From here I could do a.add(), etc.

## Length 6

use IO


This imports the IO module into the global namespace, which contains sever different classes including File, Directory, and Path. Hassium as a whole has several of these builtin modules with countless classes.

## Length 7

print()


This is the most simple function in Hassium, the print() function which takes in a string and displays it to the console without a trailing newline. print() is one of the functions that is in the global namespace, and not in a class or module.

# IPOS

### Factoid

IPOS is a stack-based golfing-language for string processing. An IPOS program places it's input on the stack at the start and prints the concatenated stack contents at the end. This has the nice side-effect that a zero byte IPOS program is equivalent to a basic cat-program.

### Length 1

L


IPOS has a set of predefined variables. This program pushes the value of the variable L to the stack which is the alphabet in lowercase letters. Remember that any input string gets placed on the stack initially. So this program appends the lowercase alphabet to the input and prints it.

### Length 2

SA


This program takes a string with space-separated words and sorts them in ascening order. For example the input Programming Puzzles & Code Golf yields the result & Code Golf Programming.

How this works
The input string is already placed at the stack. We push a space (variable S) to the stack and apply the command A which splits the input on spaces, sorts the resulting substrings in ascending order and joins the result back on spaces.

### Length 3

'A=


As mentioned in the first program, IPOS has a set of predefined variables. If you want to define a custom variable, you can do that with the = command. It creates a new variable with the name given in the top stack item and assigns the value given by the stack item below that.

Variable names can only be one character long. Also they overwrite the original meaning of this character which means that we can no longer use A for sorting as we did in the program with length 2.

So this program simply takes the input and saves it in a variable named A. Since you usually need this value right away, = also leaves the assigned value on the stack, so the output of this program is identical to the input.

### Length 4

P!r%


This program takes an input string and reverses each substring between dots. So the input abc.def.ghij yields jihg.fed.cba.

Straight to the code breakdown this time:

P!r%

P      # Push a dot '.', one of the predefined variables.
!r    # Push a command that reverses a string
%   # Split the input on dots, apply the reverse command to every substring
# and join the resulting substring back on dots.


This shows one of the commands for functional programming. Those make use of command objects that are basically strings which get treated as IPOS code. They can be created like normal strings, but instead of quotes, we use backticks for them. To create a command object with only one command we can just put a ! before it.

### Length 5

S'+Re


This program takes a string of space seperated numbers and outputs their sum. Pretty simple task, but the way it does that is quite interesting.

IPOS does not have any builtins for math operations besides simple incrementing and decrementing. It is still a language for string processing, so I didn't see a reason to include those. However, we can make use of the eval command e to do some basic math. This command takes a string and performs the numeric calculations in it using Python syntax.

You might already suspect where this is going. The above program simply replaces spaces with pluses by pushing a space and a plus character and applying the replace command R to them and the input. The resulting string then gets evaluated by e which yields the expected result.

### Length 6

S2<%


This program takes a string of space separated words and removes all but the first two characters from them.
We are using % again here which splits the input on a given character (here space), applies a set of commands to each part and joins the parts back. As mentioned above, command objects can be created just like a string, but are enclosed in backticks. The command we are applying to each part here is 2< which takes the first two characters of a string and discards the rest.

### Length 7

SC/eCPj


This program takes a string followed by a space and a number, splits the string into that many pieces and joins the result back on dots.

SC       # Split input on spaces
/      # Swap the two top stack items so the number is on top
e     # Convert the number into an integer
C    # Split the string into pieces and pushe the substrings to the stack
Pj  # Join the whole stack on dots


Somebody's already done a CSS answer, but here's another one. I promise to make the one-char snippet exactly the same. :)

### 6 chars

:hover


This is an example of a pseudo-class, which is basically the state of an element. The :hover pseudo-class applies when the element is being hovered over; some others are :active (mouse button down), :valid/:invalid (form/input is valid/invalid), and :target (element is target of current #hash-portion-of-url).

Pseudo-classes can also take arguments, for example :not(some-other-selector) and the :nth-child family: :nth-child, :nth-last-child, :nth-of-type, and :nth-last-of-type.

### 5 chars

--foo


CSS variables, properly known as custom properties, function like variables in other languages, only a bit more

c
a
s
c
a
d
i
n
g


to fit in better with the nature of CSS. Variables are used like this:

:root {
--foo: goldenrod;
}

.some-element {
background-color: var(--foo);
}

.another-element {
background-color: lightgray;
border: 3px solid var(--foo);
}


and var(--foo) is replaced with the value of --foo.

However, because these variables are parsed at runtime, not as a compilation step in a preprocessor such as Sass or LESS, they can be used more dynamically. For example:

:root { --foo: red }
body:hover { --foo: blue }
p { color: var(--foo) }


This will make the text in <p> (paragraph) elements red, except when the <body> is hovered, in which case the text will turn blue.

### 4 chars

42cm


As well as the px (pixels), em (relative to font size), rem (relative to font size of root element), vh (1/100 of viewport height), and vw (1/100 of viewport width) units, which are usually what you use, CSS also has physical units for cm, mm, and in. The only problem is that they don't necessarily represent physical centimetres, millimetres, and inches, but (device-dependent) may be relative to the assumption that 1 inch = 96px. Anyway, it's usually better to use relative units like em and rem instead.

### 3 chars

-o-


Browser prefixes allow browsers to implement WIP standards before they've been finalised. The idea is that if the spec changes, the old implementation's behind a prefix so the correct implementation can be done without the prefix. However, browsers are moving away from prefixes in favour of flags set by the user in the browser (chrome://flags in Chrome and about:config in Firefox), as prefixes have caused headaches when trying to ensure compatibility with old browsers.

The prefix shown above is for Opera (before it switched to using the Blink rendering engine); the other prefixes are:

• -webkit- for WebKit/Blink (Chrome, Opera, Safari)
• -moz- for Gecko (Firefox)
• -ms- for that thing.

Prefixes are used like this:

.foo {
-webkit-transform: rotateZ(30deg);
transform: rotateZ(30deg);
}


They can also be used on selectors and property values.

### 2 chars

//


People ask why CSS doesn't have // comments. Well it does. Sort of.

In this blog post, Tab Atkins talks about using // comments in CSS. They don't function as line comments, but rather "next construct comments". This means that these are equivalent:

foo {
color: white;
// font-weight: bold;
background-color: black;
}

// bar {
width: 12rem;
}

// @keyframes baz {
from {
opacity: 0;
}
to {
opacity: 1;
}
}


and

foo {
color: white;
/* font-weight: bold; */
background-color: black;
}

/* bar {
width: 12rem;
} */

/* @keyframes baz {
from {
opacity: 0;
}
to {
opacity: 1;
}
} */


There are also some weird tricks like using a @comment { } block to simulate nested comments.

### 1 char

*


The star hack. Sample usage:

.foo {
background-color: lightgray; /* displayed by most browsers */
*background-color: red; /* displayed by IE <= 7 */
}


Factoid: some web servers originally served .css files as application/x-pointplus, to do with presentation software, instead of text/css.

# Unipants' Golfing Language

## Factoid

UGL only has 16 operations, a stack, registers, ifs and whiles to do things. But even if these supplies are to spare, anything may be possible if you do things smart enough... or not? ;-)

## Length 5 snippet

IlOI:


Try it online!

This is the cat program. As you see, it is a translation of the brainfuck program ,[.,].

I captures one character, so it is the same as , in bf. O prints one character, so it is the same as . in bf. And l and : enclose a while loop, that works the same as [ and ] in bf (while the top of stack is non zero).

## Length 2 snippet

io


Try it online!

This program reads and writes an integer. And guess it, it can be any length. i is greedy, meaning it will catch as long an integer as possible.

## Length 1 snippet

s


Try it online!

This program sets the current register number to zero. First, let me show you an excerpt of the README for registers:

### Registers

• r - load the value in current register

• R - save the value in current register

• s - set current register number to top of stack

If the stack is empty, the current register number is set to zero.

# Tellurium

Factoid

Tellurium is an esoteric, tape-based programming language written by me in Python. It's mainly intended for use in code-golf challenges, but it pretty much failed at that task.

Length 1 snippet

^


^ is the output/print command. It outputs whatever is in the selected cell, which, in the above snippet, is 0. (0 is the default value)

Length 2 snippet

i^


This is a simple cat program (a program that copies its input to its output). i takes input and puts it in the selected cell. As you probably remember, ^ outputs whatever is in the selected cell.

(I promise that there will be more interesting snippets later on. There's not much you can do with two commands)

Length 3 snippet

I§^


This snippet calculates the factorial of the input and displays it.

I gets input and converts it to an integer. § calculates the factorial, and stores the result in the selected cell.

There are numerous other math-related one character builtins, for example:

I½^ calculates the exponent of the input

Iq^ calculates the square root of the input

Length 4 snippet

{p}f


This is an anonymous function that does... nothing.

In Tellurium, you can create an anonymous function by using the syntax {code}f. The function can then be called using the command ä.

p is a placeholder command, the equivalent to the Python statement pass.

Length 5 snippet

[I|^;


This snippet uses a loop to output 0 n times. The syntax for a loop in Tellurium is [times|code;. If I is in the times section, it will run the code input times.

Length 6 snippet

µHi!~^


Finally, something more interesting. This snippet outputs Hi!. The syntax for inserting text into the selected cell is a bit strange: µ(text)~.

Length 7 snippet

¤h|Hey]


This snippet showcases variables. Again, the syntax is a bit strange: ¤(name)|(value)]. In this case, it stores "Hey" in the variable h.

To display that variable, use ;h.^.

## GNU Octave

Snippet 7:

disp(j)
0 + 1i


Prints j out to the screen without the ans = overhead

Snippet 6:

[i](1)
ans =  0 + 1i


This generates an instance of a scalar only containing sqrt(-1), takes the first element of it (a complex number), and prints it out. A scalar is basically an array.

Snippet 3:

{3}
ans =
{
[1,1] =  3
}


This generates an instance of a matrix with one entry, 3.

Snippet 2:

[]
ans = [](0x0)


This is just a simple empty array.

Snippet 1:

j
ans =  0 + 1i


Yes, Octave understands i or j as the square root of -1!

Factoid: Octave is free and approximately 80% compatible with Matlab! (except toolboxes)

• ... I can't believe this doesn't already exist. Nice job creating it! – Rɪᴋᴇʀ May 4 '16 at 14:05
• @EᴀsᴛᴇʀʟʏIʀᴋ, Well, it does. =) – Stewie Griffin May 13 '16 at 10:04
• The question says: It is suggested that you choose a programming language that has not been posted already but this is not a requirement.", so it's OK for you to have another Octave entry. Personally, I suggest you don't use any of the features that's already covered in my (and possibly flawr's answers). – Stewie Griffin May 18 '16 at 7:48
• {3} creates a 1-by-1 cell array with a 1-by-1 matrix with the value, 3 in it. Creating a 1-by-1 cell array rarely has any pros, only cons. But the brackets can be used to create cell arrays with more elements too of course: {3, rand(3,2); 'This is a string in a cell', magic(4)}, in which case it's very useful. – Stewie Griffin Aug 10 '16 at 5:34
• This generates an instance of a matrix with one entry, 3. The way to do this exact task is simply one byte: 3! =) Try x = 3; y={3}; whos. You'll see that x is a 1-by-1 double, where as y is a 1-by-1 cell. y = {'This is a cell'} will also result in a 1-by-1 cell. whos y{1} will show that that specific cell element contains a 1-by-14 array of chars. You can't do y = {3}, followed by y==3 or y+3 if yis a cell, since they're not of the same class. – Stewie Griffin Aug 12 '16 at 8:19

## Copy

Copy is my new esolang. The only branching operations are skipping a instruction and code removing and copying, and the only arithmetic operations addition and negation.

### Length 6

skip 0


skip skip the next instruction if its argument is not 0. So here, it's essentially a no-op.

### Length 7

add a 5


Add 5 to the variable a. Since a is undefined, it set it to 5.

### Length 8

add a -8


Add -8 to the variable a. This is to demonstrate than signed numbers are allowed as command arguments.

• Good luck getting enough to make a working program. :P – user48538 Sep 24 '16 at 20:49
• Where's 1 to 5? You don't have to make full programs, you know - something like skip is acceptable. – Qwerp-Derp Sep 26 '16 at 7:55

# Fourier

## Factoid

I originally intended this to be a golfing version of Brainfuck... Alas, due to the simplicity of the language structure, this language is in no way good for golfing.

## Snippets

### Length 0 Snippet:

         

An empty program does nothing. No input, no output, no change to the accumulator.

Try it online!

### Length 1 Snippet:

o


o outputs the value of the accumulator. Since the value of the accumulator is 0 at the start of the program, 0 is outputted.

Try it online!

### Length 2 Snippet:

^o


^ increases the value of the accumulator by one. The o then outputs the value of the accumulator, printing the number 1.

Try it online!

### Length 3 Snippet:

9ro


r generates a random number between 0 and the value pf the accumulator. Here, it generates a random number between 0 and nine and then o outputs the number.

Try it online!

### Length 4 Snippet:

4^do


Uses the fifth function of the date function: outputting the current year. The other functions of the date function are:

• 0: current second
• 1: current minute
• 2: current hour
• 3: current day
• 4: current month
• 5: current year

Try it online!

## Length 5 snippet:

I*10o


Sets the value of the accumulator the user's input, multiplies it by ten and outputs the number. It's a basic program but demonstrates how user input works.

Try it online!

## Length 6 snippet:

2(5ro)


This program prints random numbers until the random number is 2. It is an example of looping:

x(code here)


Repeats the code within the brackets until the resulting value of the accumulator within the brackets is equal to the value of the accumulator at position x.

Try it online!

## Length 7 snippet:

|7o|GGG


This is an example of a function. It works like so:

|code here|x


You contain the function code within the pipes and store the function in the variable x (can be any variable name). To run the code within the pipes, just write the function name.

The function here prints the number 7 twice because g (the function name) is called twice.

Try it on FourIDE!

## Length 8 snippet:

I^~NN%2o


This is a simple program which takes an input of a single number and tells you if the number is even (1) or not (0).

It is an example of how Fourier uses 1 and 0 as truthy and falsey values.

Try it online!

## QBIC

I'm trying to teach QuickBasic to do codegolf (and myself in the process), so I'm creating the language Quick Basic Interpreter for Codegolf, or QBIC for short.

0 byte factoid

Most of QBIC's strength lies in just making a shorthand for QBasic's expansive syntax, but I've also incorporated several features of my own. When generating the trans-compiled BAS file, a standard header is imported that implements some of these features. For instance, the numbers 1 through 10 get initialised as variables q through z. This occasionally saves me some bytes when initialising a FOR loop, and shaves a byte off of using 10.

1 byte

}


The above statement will do ... exactly nothing. When found in the QBIC code, it wil automatically add END IF's, NEXTs and LOOPs for every opened IF/FOR/DO construct it finds (in the correct order, naturally). Note that ] does the same for one language construct, where } closes all opened constructs.

However, since we've not yet opened any of those constructs, this does nothing and results in an 'empty' Qbasic BAS file. Also, at the end of compiling QBIC, the compiler will run this statement automatically.

2 bytes

?z


This will write 10 on the screen. In QBIC, the letters of the lower-case alphabet are references to numerical variables. This is retained from QBasic, where PRINT a would give me a 0 on the screen (even without ever defining a). In addition, QBIC initialises q-z to be 1 through 10 by default. The ? is obviously shorthand for the PRINT statement and writes to screen.

3 bytes

_Xb


_X can be used to terminate a program, and when used with a suffix, it will print something on exit. Suffixes can be A-Z (which refers to string variables A$- Z$) or lowercase a-z (for the numerical vars of this name). The example snippet ends the program, and prints variable b to screen before it turns off the lights.

4 bytes

?_r|


_r is a random number generator. By itself, it will generate a random number between 0 and 10 and, in this case, print it. We can also add one or two parameters for a different lower and upper bound; If only one is specified, that's our new upper bound.
_r20| will generate a number between 0 and 20.
_r5,18| will generate a number between 5 and 18. The statement _R is equivalent to _r with one exception: _R assigns to a variable, _r does not:

?_r|    PRINT getNextRandomNumber(0, 10)
_R|?a   a = getNextRandomNumber(0, 10) : PRINT a


5 bytes

:_Ra|


The above snippet introduces the :, which reads the first unread command line parameter and assigns it to the first available numeric var. The resulting QBasic code for this snippet is:

a = assignCMDToNum!
b = getRandomNumber(0, a)


There's also ;, which does the same for string variables.

6 bytes

?!z$+A  Here, we see a cast in action. QBasic is kinda picky when it comes to data types. Adding a string to an integer will result in errors. To work around this, I've added a casting function. The above snippet will print 10 (z is auto-initialised to 10) and append whatever is in the variable A$. For instance, a full program could be

#test?!z$+A  and the result then is 10test. Casting is done using the ! symbol. It then casts everything between the ! and the delimiter. Usually | is the delimiter for variable-length arguments, but CAST uses either a $ to perform the cast from number to string, or another ! to cast a string to number.

7 bytes

Z=_f_tA


Lot going on here. Let's work on the assumption that A$ already holds a value, say " Hello " (significant spaces). This snippet then sets Z$ to the reversed (_f), trimmed (_t) version of A$, olleH and prints it to the screen. • The behaviour between _f and _F is different: _F declares a variable and assigns its output to it, _f only gives the output and assigning is done by other parts of the script. The same goes for _r in my 5-byte snippet. This is called ULX, or Upper-Lowercase Extension. Whether or not output gets auto-assigned is one of the behavioural changes ULX can bring, but there are other examples. _D, for intance, yields the system date, _d yelds system time. Both don't auto-assign. • _t removes the whitespace on both sides of its argument. _u does a left-trim, _v does right-trim. All three support ULX, and for all three this switches between auto-assign (uppercase) or output only (lowercase). • Both _f and _t should be delimited with | to signify the end of the parameter list. However, since EOF is reached, the correct number of |'s get added to close all opened parameter lists. If this statement would have been followed by the closing commands for language constructs (]or }, see byte 1) those same |'s would get added. • QBIC allows for the result of one function to be the input for the next: _f takes as input the result of _t • Finally, if we would run this program, it would actually print olleH, despite we never use a ? or _X* statement. This is because QBIC implicitly prints the contents of Z$ on exit.

Summarizing, the above 7-byte snippet would roughly compile into this QBasic block:

FUNCTION revstring$(in$)
... function definition imported through QBIC.H
END FUNCTION

... we set A$to be " Hello " Z$ = revstring$(LTRIM$(RTRIM$(A$)))

PRINT Z$ 8 bytes Let's look at literals. There are 2 types in QBIC: String literals (Verbal and Silent) and Code Literals. They are started with @, # and ' respectively, are terminated with . Using a &boxul; respresents a line-break. ?@check --> Verbal string literal: Defines A$ in the header, assign the value "check"

## Length 2

p
a


Nesting allows you to stop repeating the names of the elements, and looks much prettier and easier for a person to read.

# Simplex

Version is the latest, unless otherwise specified; interpreter is currently down; docs a little unupdated as of now.

## 6-vote

1(D)10
1      ~~ sets current byte to 1
( )10 ~~ repeat inner 100 times
D    ~~ double current byte
~~ implicitly output byte


This outputs 2^10 in its exact form. Simplex has something I liked to call “Infinite Capacity Numerics®”. It can be a bit slow sometimes, but is/will be highly precise.

## 5-vote

"hi"g


Writes a string hi to the strip and outputs it.

## 4-vote

eRPE


Outputs eπ ≈ 23.1406926328. e is Euler's number, R goes right in the strip, P is π, and E is exponentiation. Output is implicit.

## 3-vote

i¢I


A little code that takes numeric input, terminates if input = zero, otherwise increments the byte. Implicitly outputs the result. (It's also French! (ish): ici => here)

## 2-vote

MO


Shortest way to create a bounds error; M decrements the byte and O goes to the current byteth position in the source code…maybe I should include negative source codes…nah, who'd go for it?

## 1-vote

5


Not very interesting, but writes 5 to the current strip's first cell. (Also implicitly outputs 5.)

## 0-vote

Simplex is a golfing language which functions similar to BrainF***, made by me. It is very much a work in progress, but has about 60 standard commands. It is composed of a singular field, which holds a bottom-closed, top-open, infinite amount of strips, each of which contains a right-open, left-closed, infinite amount of cells and a pointer. The field can be visualized as thus:

5: [0 0 0 0 0 0 0 ... ]
^
4: [0 0 0 0 0 0 0 ... ]
^
3: [0 0 0 0 0 0 0 ... ]
^
2: [0 0 0 0 0 0 0 ... ]
^
1: [0 0 0 0 0 0 0 ... ]
^
0: [0 0 0 0 0 0 0 ... ]
^


Each pointer moves independent of other pointers. Typically, only one or two strips are utilized in a single program.

• ¢ is two bytes – SuperJedi224 Nov 4 '15 at 14:19
• @SuperJedi224 no, it isn't. – Conor O'Brien Nov 4 '15 at 15:06
• @SuperJedi224 And even if it was, this challenge is graded on characters, not bytes. – Conor O'Brien Nov 4 '15 at 15:11
• in UTF-8, it is. I suppose you're right that it doesn't matter here though. – SuperJedi224 Nov 4 '15 at 20:09

# 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. – Cows quack Nov 3 '15 at 17:23
• @CᴏɴᴏʀO'Bʀɪᴇɴ There! The carrot is back again in the third byte! – Cows quack 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