Count in octal: Difference between revisions

Content added Content deleted
m (J: rephrase, and explain)
Line 693: Line 693:
So then we define disp as a word which displays its argument in octal and returns its argument as its result (unchanged).
So then we define disp as a word which displays its argument in octal and returns its argument as its result (unchanged).


Finally, the <code>(1+disp)^:_</code> clause tells J to repeat this function forever, adding 1 to the result each time (or repeat until it gives the same value back twice in a row - which won't happen, or to stop when the machine stops - like if the power is turned off or J is shut down...).
Finally, the <code>^:_</code> clause tells J to repeat this function forever, with <code>(1+disp)</code>adding 1 to the result each time it is displayed (or at least tha clause tells J to keep repeating that operation until it gives the same value back twice in a row - which won't happen - or to stop when the machine stops - like if the power is turned off - or if J is shut down - or...).


We use arbitrary precision numbers, not because there's any likelihood that fixed width numbers would ever overflow, but just to emphasize that this thing is going to have to be shut down by some mechanism outside the program.
We use arbitrary precision numbers, not because there's any likelihood that fixed width numbers would ever overflow, but just to emphasize that this thing is going to have to be shut down by some mechanism outside the program.