We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Talk:RAT

From Esolang
Jump to navigation Jump to search

ToggleSkip to RAT

Same ToggleSkip language (which I think is TC and I will prove it sometime in the future) can be translated to it:

* - ><
> - ><>
< - <
| - ><|><

--ChuckEsoteric08 (talk) 17:40, 28 October 2026 (UTC)

Logical circuits

I didn't want to spam the user talk page with code examples, but I looked into it a little after seeing it discussed. It's possible to implement arbitrary logical circuits in RAT. The following program implements a controlled swap, if we assume that we start on the control bit, with the two bits to be swapped to the right, and three zeroed scratch bits following those:

# If current bit is 0, move 3 spaces to the right.
| ><> ><> ><> |
# Move to the next bit to the right.
><>
# XOR Swap:
# If the current bit is 1, move to the right, negate, then move back to the left.
><| ><> >< < |><
# Move right
><>
# If the current bit is 1, move to the left, negate, then move back to the right.
><| < > |><
# Move left.
<
# If the current bit is 1, move to the right, negate, then move back to the left.
><| ><> >< < |><
# Move left.
<
# If current bit is 0, move 3 spaces to the left.
| <<< |

Going through this implementation process also made me realize that the ToggleSkip translation in the section above (| - ><|><) does not seem totally accurate, because the code before or after the | may not actually execute depending on the state of the active bit and so the current cell might be left permanently flipped (thus, in the code example here, I have to use little ><|/|>< pseudobraces instead). The translation between languages that toggle the active bit on a current cell of 0 and those that toggle on 1 may not be something that can be done with that kind of simple substitution, although programming in either type of language seems basically comparable.

Since you can also pull out the little XOR implementation as an additional gate, RAT is universal over reversible logical circuits. It seems pretty likely to me that this language would be Turing complete on that basis, since it can perform arbitrary circuits, has unbounded memory, and runs in a loop. But I don't have an exact sketch of how it would be structured; probably it would be simplest to use a reversible Turing machine as ais523 said, and store a one-hot encoding of the Turing machine's state; then you could allocate large multi-bit cells for each cell of the tape and just move the entire state machine from cell to cell whenever you shift the tapehead. Though, there's still a lot of individual details that would need to be sorted out about the simulation. --ImOnlyHereForReversibleComputing (talk) 03:26, 12 November 2026 (UTC)

I actually did start trying to build a RTM in ToggleSkip in similar way I've proven MFJZ right after I put it in the talk page but I did not finish it as there were some problems --ChuckEsoteric08 (talk) 07:56, 12 November 2026 (UTC)

The word "active" is misleading

Since the word is adjective, the phrase "toggle active if..." may be read as "toggle active cell if..." or "toggle current cell if..." which is semantically wrong. I suggest to rename it to "accumulator" or "flag bit". --Blashyrkh (talk) 04:22, 12 November 2026 (UTC)