We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

()s

From Esolang
Jump to navigation Jump to search
The title of this article is not correct because of technical limitations. The correct title is actually {}s.

{}s (pronounced: Sets) is an esolang made by User:AmNow.

Commands

{}: Expression (can be nested) ie: {%+%}
%: the constant 2.
(ANY NUMBER): A variable.
<: Assignment. ie: 2<{%/%}
Note: The value before the < operator must be a number, not a billion %s, strung with math. (Don’t worry, it will not represent the value in it.)
[x, {...}]: Loop, While x isn’t 0, do the expression.
+,-,*,/ are math operators, referring to plus, minus, multiply, and divide respectively. {}s follows PEMDAS order.
=: Equal To
\: NOT Equal to
~: Less Than
$: Greater Than
&: Logical AND
@: Logical OR
|: Logical XOR
!: Logical NOT
#: switches from Unicode character output to Number output and vice versa. (starts on Unicode)

A write to 0 will print the value assigned to it (like 0 in `) and a reference to 1 will get from the input.

EOF is 0.

Programs

Truth Machine

# 2<1 0<2 [2, {0<2}]

Cat Program

This example implements a repeating cat program which terminates on a null character input:

2<1 [2, {0<2 2<1}]

Looping Counter

This program queries the user for an integer number, counts up from one (1) to the same, and displays during each cycle on a line of its own a catena of asterisks (“*”) tantamount to the current counter state:

#
2 < 1
3 < {% / %}
4 < {% - %}
5 < {{% * % * % * % * %} + {% * % * %} + %}
6 < {{% + %  + {% / %}} * %}
#
[2 $ {% - %},
  {4 < {% - %}
    [4 ~ 3, {0 < 5 4 < 4 + {% / %}}]
    0 < 6 
    2 < 2 - {% / %}
    3 < 3 + {% / %}}]

Computational class

{}s is Turing-complete, which can be proven via translation from Portable Minsky Machine Notation.

PMMN {}s
inc(X); X < {2 + {% / %}}
dec(X); C < X [C, { X < {X - {% / %}} C < {% - %} }]
while(dec(X)) { ... } [X, { X < {X - {% / %}} ... }]
if(dec(X)) { ... } C < X L < X [C, { X < {X - {% / %}} C < {% - %} ... }]
else { ... } L < {L = {% - %}} [L, { L < {% - %} ... }]

Every C and L in the translated program must be replaced by a variable unused by a register in the PMMN program. Every C can be replaced by either the same variable or by different variables. Every L must be replaced by the same variable in the same scope, and a different variable in a different scope (so every scope will have a unique L variable).

Due to how I/O works, variables 0 and 1 cannot be used. These variables must be replaced by unused variables if they are in the translated program.

Interpreter

  • Common Lisp implementation of the {}s programming language.