Hyper Set Language

From Esolang
Jump to navigation Jump to search

Hyper Set Language is an esolang idea by User:Zzo38, based somewhat on Set Language, but, it is possible to have multiple answers, or no answers, or even to have a set of all sets that are not members of themself!


To define a word, you do:


The semicolon marks the end (although the definitions can also contain semicolons). The name syntax is [A-Za-z_][A-Za-z0-9_]*


All values are sets, although they can be treated as certain kinds of values:

Everything is a set. To create, put the values inside [] with semicolons separating the values. It has no order, so each value can either be in the set or not in the set.
Is represented by an expression inside of {} and can contain # to access its argument. You can put a number after # to specify the argument of other functions that this one is defined in, such as: K_combinator={{#1}}; The function is a set of pairs, where the left part of the pair is the input value, and the right part of the pair is the output value. You can also chain values by using semicolons inside the definition, the last part is the value of the function, and @ represents the value of the previous part that are separated by semicolons.
This is an ordered pair of two values, one on the left and one on the right. Use the . operator to create a pair. A pair (x.y) is the set [[x];[x;y]]
Natural numbers, expressed as the set of all lower numbers (0 is the null set). You can just type the number directly into the program. That is: successor={#|[#]};


Comments are indicated by two equals signs.


Syntax Description
(x) The parentheses for grouping operators.
x&y The set containing elements that exist in both of those sets.
x|y The set containing all elements that exist in either set.
x!y The set containing all elements that exist in x but not y.
* The set of all sets (including itself).
x.y Create a pair with x on the left and y on the right.
x/y The right part of the pair in x that has y as the left part of that pair.
x\y Like x/y applied to each element of the set y and the set of all results from that is returned.
<x Left part of the pair.
>x Right part of the pair.
x%y Apply a function x with argument y (same as x/y), with the result as the first element of the set, and then apply function x on the first element to make the second element of output, and then repeat an infinite number of times.
@ This can be used in a {} or () block, as described above. Example: (xyz/abc;@/@) is the same as ((xyz/abc)/(xyz/abc))

Multiple Answers

Here are some notes about multiple possible answers for a program:

  • When a function can have no valid answer for a certain input, the set representing that function does not contain a pair with that input on the left side. When there are multiple valid answers, there are multiple pairs with that on the left side.
  • A function {} itself is still only a single value, though.
  • The program (*/*) can have all answers possible.
  • The program (0/0) has no output.


successor={#|[#]}; == Successor of a number
predecessor=reverse\successor; == Predecessor of a number
equal={[<#]&[>#];not/(not/@)}; == Check if two sets are the same
power={{#&#1}\*}; == Power set
Russell={[0.#;1.0]/(element_of/(#.#))}\*; == Russell's paradox
I={#}; == Set of all pairs the left and right part are same