Draft:D.splice(...d.splice(...d))
From Esolanging
Jump to navigationJump to search
d.splice(...d.splice(...d)) is the ZISC interpreted by the function d=>{while(!+d.splice(...d.splice(...d)));} in JS.
Semantics
Programs are given as an array of integers in the interval (-253, 253)[1]. This will be set as the initial value of d, which is the program's state. On each tick, the following happens:
- Let splice1 be the slice of
dstarting fromd[0]containingd[1]elements. Replace this slice withd[2:]ind. This phase is called the inner splice. - Let splice2 be the slice of
dstarting fromsplice1[0]containingsplice1[1]elements. Replace this slice withsplice1[2:]ind. This phase is called the outer splice. - If splice2 is of length 1, and its sole element is none of
0,-0, orNaN, the program halts. Otherwise, execution continues with the next tick.
- ↑ If I need ±Infinity I'll add it, but I don't think I will.
Computational class
It seems Turing-complete but I have been stuck on this for a while now, so I'll just leave this here so I can come back to it at some future point in time.
- Adding/copying information is best done in the inner splice, while removing information is best done in the outer splice.
- My current idea is two "stacks" (or at least something that seems stack-like enough to me to call them stacks, even though they're less restricted than that), one stored at the beginning of the array and operated using positive indices, and one stored at the end of the array and operated using negative indices, with a bunch of garbage left in between. The main operation will be to copy the top n elements of each stack.