Pocket Rewriting (2024)

Tomte1 pts0 comments

XXIIVV — pocket rewriting

Multiset Rewriting Pocket Computer18U12A zine on multiset rewriting.

A eight-pager that introduces the concept of rewrite<br>programming with a few examples. It also includes the source code for a<br>tiny Fractran interpreter. The back<br>cover is purposely left blank to allow for note-taking. To play with the<br>examples in an emulator, see Tote.

Print on A4, without margin, or find the 4 tiny black printed dots at<br>the edge of the page, and remove excess margin with scissors.

Folding instructions

Tote is a multiset rewriting language.

Riffing on Le Guin's Carrier Bag Theory of Fiction, this presents a<br>primordial vision of computation in which programs are written as a list of changes in the content of a bag, and programming can<br>be done entirely with a touch interface and without the need for textual<br>representations.

To learn more, see the examples from Pocket<br>Rewriting, and Fractran.

Programming is done by dragging things from the Panel (left) into the<br>Rules (middle) or Bag (right). Step through the evaluation by<br>pressing the button with the squiggly symbol(bottom right) to rewrite the<br>symbols in the Bag.

Introduction

During evaluation, rules are tested in a sequence from the first to the last,<br>when the bag contains a rule's left-side, the symbols are replaced by those in<br>the right-side, and search for the next rule starts back again from the<br>beginning.

Subtract Program

:: x y sub > sub<br>:: x sub > pos sub<br>:: y sub > neg sub<br>:: sub >

Once the rules have been created, add things to the Bag by dragging them from<br>the Panel. To get the result of 8-3, add 8 times the first symbol(triangle), 3<br>times the second(lozenge), and the subtract symbol(empty dot). Step through the<br>evaluation by pressing the squiggly symbol until transformations are no longer<br>possible.

Content of Bag

x=8 y=3 sub<br>pos=5

Loops

Here's a little fizzbuzz program that demonstrates how to create loops and<br>conditionals. Notice how the order of rules will erase the fizz/buzz tokens<br>before incrementing the counters.

Your browser does not support the video tag.

The program above is roughly equivalent to the following bit of<br>pseudocode:

while(x++ || y++) {<br>if(x == 3) print_fizz(), x = 0;<br>if(y == 5) print_buzz(), y = 0;

Setting Anchors

Clicking inside the bag during symbol editing gives that symbol an<br>anchor position , when that symbol will be created as the result of a<br>rule, it will spawn at that location.

Your browser does not support the video tag.

To open the Symbol Editor , click on the symbols in the Panel(left),<br>this menu allows to draw new symbols, save/load the<br>symbols, lock/unlock the dragging of the symbol in the bag, activate<br>continuous/step mode for when the symbol is clicked on.

Click on a rule's arrow to toggle between one of four triggers that can<br>trigger the rule:

--> On step

>-- On clicking on a symbol

-<> On dragging a symbol onto another

..> On a timer

watch examples, playlist by CapitalEx

view source

download rom

Community, Discord

Original characters by Rek Bellum

incoming: tote paper rewriting rewriting fractran 2024

symbol rewriting from symbols rule pocket

Related Articles