rejig

Example Programs
Login

Example Programs

To better understand what rejig does, consider my right triangle solver, available in four different forms:

  1. The hand-annotated version at the top of that linked article.
  2. The P47 version produced on an R47 via WRITEP.
  3. The RTF version produced on an R47 via XPORTP.
  4. The Unicode pretty-printed version produced by rejig in its default operating mode: -f p47 -t utf8

Comparing those files should prove instructive. If you then copy the text from #1 into a file tri.p47u, try saying:

rejig tri.p47u -o tri.p47

That should get you the same file as #2. You could then round-trip it via:

rejig tri.p47 -o tri.txt

Small details may differ, depending on how rejig has evolved in the meantime, but the two programs should do exactly the same thing.

More

For more examples, see the R47 directory on Enter RPN, which hosts the R47 program corpus; each .p47 file there has a corresponding .p47u file produced by rejig.

(You may now wish to return to the rejig home page.)

License

This work is © 2026 by Warren Young and is licensed under CC BY-NC-SA 4.0