-3

Can some one explain subleq to me better? I am looking at http://esolangs.org/wiki/Subleq

There example:

3 4 6
7 7 7
3 4 0

the first instruction, at address zero, subtracts 7 (address 3) from 7 (address 4). The result in address 4 is 0, so jump to 6. Starting at address 6 is the instruction 3 4 0 which again subtracts 7 from now 0 and jumps back to 0. Here is a sequence of execution (A and B are shown after subtraction)

0: 3 4 6 A=7 B=0
6: 3 4 0 A=7 B=-7
0: 3 4 6 A=7 B=-14
6: 3 4 0 A=7 B=-21
0: 3 4 6 A=7 B=-28
...

My first question is address 0 "3 4 6 A=7 B=0"? Where did they get 7? Is it from the first two number? I thought it has to do with subtraction :S

2
  • Can some one explain subleq to me better? SO is for coding problems. Not a blog.
    – EZI
    Mar 30, 2015 at 20:40
  • Don't tag questions with irrelevant languages.
    – MattDMo
    Mar 30, 2015 at 20:43

1 Answer 1

0

If we look at the matrix:

3 4 6
7 7 7
3 4 0

As a memory map addressed in the following manner (sequentially):

0 1 2 
3 4 5
6 7 8

The quoted text is making a perfect sense. There is 7s in the addresses 3 and 4, and the next instruction is 3 4 0 located at address 6.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.