I have 4 different commands in LOOP programming language:
y=Zero()
y=Val(x)=copy x and put it in register y
y=Inc(x)=x+1
y=Dec(x)=x-1
Finally I also have
loop n times {
...
}
How is it possible that there is an equivalent loop program to every other loop program which uses only Inc, Zero and the loop?
For me it is not clear how to express the Dec-command using only Inc, Zero and the loop.
0
Here’s one way to code y=Dec(x):
y=Zero();
z=Zero();
loop x times {
loop z times {
y=Inc(y);
}
z=Zero();
z=Inc(z);
}
5