Comment by entaloneralie
13 hours ago
This is amazing! I love seeing FRACTRAN-shaped things on the homepage :) This reminds me of how 1-bit stacks are encoded in binary:
A stack of zeros and ones can be encoded in a single number by keeping with bit-shifting and incrementing.
Pushing a 0 onto the stack is equivalent to doubling the number.
Pushing a 1 is equivalent to doubling and adding 1.
Popping is equivalent to dividing by 2, where the remainder is the number.
I use something not too far off for my daily a programming based on a similar idea:
Rejoice is a concatenative programming language in which data is encoded as multisets that compose by multiplication. Think Fractran, without the rule-searching, or Forth without a stack.
Wouldn't you also need to keep track of the stack's size, to know if there are leading zeros?
For trailing zeros yeah, or if you care for stack overflow/underflow. Here's a few primitives if you wanna try it out:
https://paste.sr.ht/~rabbits/cd2369cc7c72bfad0fcd83e27682095...
Did you just explain base-2 numbers on the HN forums as if it were novel?
You missed the part where the number is being used as a 1-bit stack. They never claimed novelty, it's just a neat technique that might be unfamiliar to most people.
I never claimed it was novel, chill.
It's dry humor?