Code Golf Asked on November 19, 2021
Notes
This thread is open and unlocked only because the community decided to make an exception. Please do not use this question as evidence that you can ask similar questions here. Please do not create additional showcase questions.
This is no longer a popularity-contest, nor are snippet lengths limited by the vote tally. If you know this thread from before, please make sure you familiarize yourself with the changes.
This thread is dedicated to showing off interesting, useful, obscure, and/or unique features your favorite programming languages have to offer. This is neither a challenge nor a competition, but a collaboration effort to showcase as many programming languages as possible as well as possible.
All answers should include the name of the programming language at the top of the post, prefixed by a #
.
Answers may contain one (and only one) factoid, i.e., a couple of sentences without code that describe the language.
Aside from the factoid, answers should consist of snippets of code, which can (but don’t have to be) programs or functions.
The snippets do not need to be related. In fact, snippets that are too related may be redundant.
Since this is not a contest, all programming languages are welcome, whenever they were created.
Answers that contain more than a handful of code snippets should use a Stack Snippet to collapse everything except the factoid and one of the snippets.
Whenever possible, there should be only one answer per programming language. This is a community wiki, so feel free to add snippets to any answer, even if you haven’t created it yourself. There is a Stack Snippet for compressing posts, which should mitigate the effect of the 30,000 character limit.
Answers that predate these guidelines should be edited. Please help updating them as needed.
$.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>
ErrLess is a functional language where every command is one character long. Its defining feature is that it refuses to throw any errors, even if you divide by zero!
You can run ErrLess in your browser by inserting your code into the code
section of this python program.
.
Halts instantly. In ErrLess, when the instruction pointer reaches the end of the program, it loops back to the start. This means that you have to explicitly halt your programs.
i?
A simple cat program that infinitely echoes stdin to stdout. i
fetches one character of input, which is then outputted using ?
, and then the instruction pointer loops back to the start.
'A?
Prints the character A
indefinitely. Why do you only need an opening quote, and not a closing quote? Simply because I thought that there is no need for a closing quote, since a character can only be, well, one character long.
12#.
This program does not output 12
, as one might expect, but only outputs 2
. Remember: every command is a single character long. First one is pushed to the stack, then two, then the top value of the stack is printed as a number, then the program halts.
e3*#.
The answer to life, the universe, and everything. This program outputs 42: a
through f
push 10 to 15 to the stack, and the *
operator multiplies the top two elements of the stack.
Answered by Ruan on November 19, 2021
Pxem is an esoteric language designed by "ぬこ" (now "nk."), published in 2008. Unlike many other languages, filename matters first and content is second; that is, a Pxem program consists of two strings.
If content is empty, calling .e
is equivalent to duplicating entire stack.
.
Every command has this prefix; this may be awkward when you want to push the character directly, on some problems.