SELENE.

From Esolang
Jump to navigation Jump to search

SELENE. is a language inspired by SELECT., but using hyperoperators instead of just exponentiation and logarithms.
Every command is separated by a space, with newlines able to be placed anywhere in between commands. Any line starting with { is a comment line. There are 3 pointers: the data pointer (DP), the base selector (B), and the rank selector (R). The current cell is the cell pointed at by DP. All cells are initially set to 1/2, and can hold any positive real number.

Commands

Command Function
left Move DP one space to the left
right Move the DP one space to the right
start If current cell is 0, jump 1 command past matching end
end If current cell isn't 0, jump 1 command past matching start
take Input either an integer (a string containing only 0-9, like 1234) or a fraction (2 integers divided by a /, like 12/34) and store it in the current cell
print Print the current cell's decimal expansion. If it repeats forever after a certain point, cut it after the first repetition. Remove trailing 0s
ascii Print the ASCII character corresponding to the current cell rounded to the nearest integer mod 128
setr Move R to current cell
setb Move B to current cell
power Set current cell to h(R,DP,B) (see Hyperoperations section)
root Set current cell to rt(R,DP,B) (see Hyperoperations section)

Hyperoperations

The hyperoperations are defined as:

h(0,a,b) = a+b
h(r,a,≤1) {r∈N} = a
h(r+1,a,b+1) {r∈N} = h(r,a,h(r+1,a,b))
rt(r,a,b) is defined so that rt(r,h(r,a,b),b) = a
m(r,a,b) {r∈N} = rt(r+1,h(r,a,b),2)
m(m(0,x,y),a,b) {m(0,x,y)∉N} = L, where: 
 a(0) = a
 b(0) = b
 a(i+1) = m(x,a(i),b(i))
 b(i+1) = m(y,a(i),b(i))
 L = lim{x->inf}(a(i))
M(r,a,b) is defined so that m(r,M(r,a,b),b) = a and m(r,M(r,a,b),a) = b
h(r,a,b) {r∉N} = M(r,m(r,a,b),M(r,2,4))
h(r,a,b) {r∉Q} = lim{x->r}(h(x,a,b))

Example program: Truth-machine

take start print end print

External Resources