|
|
|
|
|
by entaloneralie
75 days 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. https://wiki.xxiivv.com/site/rejoice |
|
https://en.wikipedia.org/wiki/Bitwise_operation#Bit_shifts