Domain

From Esolang
Jump to navigation Jump to search

Domain is an esolang created by User:Snacked. Its gimmick is that there are multiple domains containing different values but controlled by the same program, and when two values have the same history and name, they merge.

Symbols and documentation

Be warned--this program has many redundant symbols that are only for ease of programming, even though its only operator is subtraction.

Assigning and changing a value and its properties

1/x1="hi"

The above example has the value's domain as 1, the name x1, and the object assigned "hi".

Moving a value

1/x1="hi"
1/x1>2

Now that x1 is in the second domain, its being in the first domain is now in its history, and 2 is the first domain shown on it:

2/1/x1

is now the value.

Removing a domain from a value's domain history

1/x1="hi"
1/x1>2
2/1/x1-1/1

The first 1 is what domain to remove from its history, and the second 1 is the instance, even though there is only one instance as of right now. This is because numbers without slashes are reserved for subtraction to numerical values. The value, hence, looks like:

2/x1

.

Assigning a nickname to a value

As demonstrated, it can get very hard to keep track of a value. This is where nicknames are introduced.

1/x1="hi"
1/x1~str
str>2
str-1/1

This is the last program rewritten using a nickname.

Turns and lists

Since this is seemingly deterministic, it is useful to have constants notating the list after n turns, or that turn itself. The list after n turns is written

Ln

while the nth turn is written

Tn

. Turns are separated by underscores.

Other

Conditionals are written

?ifthis{thenthat}

. Waypoints are written

^here

, and jumping to them is

-here

. An input is simply

i

. The recycle bin is domain 0, and removes all history of domains from a value except for its current one (0). Values are still stored and merged in it. The properties are d: domain

  1. history
  2. /domain/instance: what the value last was when it was in a domain.

Finally, printing a value or its property is like

1/x1="hi"
1/x1~str
"str

Or, to print an example property, "str/d will print 1.

Examples

Hello World

1/x1="Hello, World!"
_
"1/x1

Quine

1/x1=T0
_
"1/x1

T0 is weird, because it seemingly doesn't exist. In reality, it seems to be the index of all the turns and lists. (the creator of this program forgot how this was a quine at all)

Cat

1/x1=i
_
-w1
"1/x1
1/x1=i
^w1

By User:Para.

Truth machine

1/x1=i
_
?1/x1{
-w1
^w1
}

By User:Para.

Adder

1/x1=i
2/x1=i
_
2/x1>1
2/1/x1-2/0
_
_
"1/x1

This program uses merging, and is by User:Para.

Negator

1/x1=i
_
1/x1=0-1/x1
"1,x1

By User:Para.

Multiplier

1/x1=i
1/x2=i
1/x1~X1
1/x2~X2
1/x3=0-X2
_
-w1
?X1{
  ^w2
}
X1=X1-1
X2=X2-1/x3
^w1
_
-w2
"mul2

By User:Para.

Resetter

0/x1=L0
0/x1
"0/x1

This program utilises the recycle bin to infinitely reset itself; again, the creator does not remember how this infinitely resets, but is trusty in their own self that they did not make a mistake.

99 bottles of beer

1/x1=99
1/x1~X1
1/x2=""
1/x2~X2
2/x2=""
1/x3=97
_
-w1
?1/x3{
^w2
}
2/x2=X1
2/x2>1
1/2/x2-2/0
2/x2=" bottles of beer on the wall, "
2/x2>1
1/2/x2-2/0
2/x2=X1
2/x2>1
1/2/x2-2/0
2/x2=" bottles of beer.
Take one down and pass it around, "
2/x2>1
1/2/x2-2/0
X1=X1-1
2/x2=X1
2/x2>1
1/2/x2-2/0
2/x2=" bottles of beer on the wall.

"
2/x2>1
1/2/x2-2/0
1/x3=1/x3-1
"X2
X2=""
2/x2=""
^w1
_
-w2
1/x4="1 bottle of beer on the wall, 1 bottle of beer.
Take one down and pass it around, no more bottles of beer on the wall.

No more bottles of beer on the wall, no more bottles of beer.
Go to the store and buy some more, 99 bottles of beer on the wall."
_
"1/x4

Huge thanks to User:Para, again.