There are no "practice problems"; you are assumed to be learning
Muddle for some purpose, and your work in achieving that purpose will
-be more useful and motivated than artificial problems. In several
+be more useful and motivating than artificial problems. In several
cases, the examples contain illustrations of important points which
-are not covered in the text. Ignore examples as your peril.
+are not covered in the text. Ignore examples at your peril.
This document does not assume knowledge of any specific programming
language on your part. However, "computational literacy" is assumed:
-------------------------
First, catch your rabbit. Somehow get the interpreter running -- the
-program in the file `SYS:TS.Muddle` in the ITS version or
-`SYS:Muddle.SAV` in the Tenex version or `SYS:Muddle.EXE` in the
+program in the file `SYS:TS MDL` in the ITS version or
+`SYS:MDL.SAV` in the Tenex version or `SYS:MDL.EXE` in the
Tops-20 version. The interpreter will first type out some news
relating to Muddle, if any, then type
IMLAC, ARDS, Datapoint), it firsts clears the screen.
Typing `^G` (`CTRL`+`G`) causes Muddle to stop whatever it is doing
-and act as if an error had occurred ([section
-1.4](#14-errors-simple-considerations-1)). `^G` is generally most
-useful for temporary interruptions to check the progress of a
+and act as if an error had occurred (section 1.4). `^G` is generally
+most useful for temporary interruptions to check the progress of a
computation. `^G` is "reversible" -- that is, it does not destroy any
of the "state" of the computation it interrupts. To "undo" a `^G`,
type the characters
(This is discussed more fully far below, in section 16.4.)
Typing `^S` (`CTRL`+`S`) causes Muddle to **throw away** what it is
-currently doing and return a normal "listening" state. (In the Tenex
-and Tops-20 versions, `^O` also should have the same effect.) `^S` is
-generally most useful for aborting infinite loops and similar terrible
-things. `^S` **destroys** whatever is going on, and so it is **not**
-reversible.
+currently doing and return to a normal "listening" state. (In the
+Tenex and Tops-20 versions, `^O` also should have the same effect.)
+`^S` is generally most useful for aborting infinite loops and similar
+terrible things. `^S` **destroys** whatever is going on, and so it is
+**not** reversible.
Most expressions in Muddle include "brackets" (generically meant) that
must be correctly paired and nested. If you end your typing with the
Most storage used explicitly by Muddle programs is obtained from a
pool of free storage managed by a "garbage collector". Storage is
-obtained from this pool by the `SUBR`s which construct objects. When a
-`SUBR` finds that the pool of available storage is exhausted, it
-automatically calls the garbage collector.
+obtained from this pool by the `SUBR`s which construct objects. When
+such a `SUBR` finds that the pool of available storage is exhausted,
+it automatically calls the garbage collector.
The garbage collector has two algorithms available to it: the
"copying" algorithm, which is used by default, and the "mark-sweep"
lose.
Thus, if you just "forget about" an object, that is, lose all possible
-means of referencing it, its storage is automatically reclaimed.
+means of referencing it, its storage area is automatically reclaimed.
"Object" in this context includes that stack-structured storage space
used in `PROCESS`es for functional application.
5. Finally, the "mark-sweep" algorithm sweeps through the storage
space, adding unmarked objects to the internal free lists for
later re-use. The "copying" algorithm maps the inferior process's
- address space into Muddle's own, replacing old garbagey with the
- new compact storage, and the inferior process is destroyed.
+ address space into Muddle's own, replacing old garbagey storage
+ with the new compact storage, and the inferior process is
+ destroyed.
22.5 GC
-------
causes the garbage collector to run and returns the total number of
words of storage reclaimed. All of its arguments are optional: if they
-are not supplied, a call to GC simply causes a "copying" garbage
+are not supplied, a call to `GC` simply causes a "copying" garbage
collection.
If *min* is explicitly supplied as an argument, a garbage-collection
parameter is changed permanently before the garbage collector runs.
*min* is the smallest number of words of "free" (unclaimed, available
for use) movable garbage-collected storage the garbage collector will
-be satisfied with having after it is done. Initially it is 8192 words.
-If the total amount of reclaimed storage is less than *min*, the
-garbage collector will ask the operating system for enough storage (in
-1024 word blocks) to make it up. N.B.: the system may be incivil
-enough not to grant the request; in that case, the garbage collector
-will be content with what it has, **unless** that is not enough to
-satisfy a **pending** request for storage. Then it will inform you
-that it is losing. A large *min* will result in fewer total garbage
-collections, but they will take longer since the total quantity of
-storage to be dealt with will generally be larger. Smaller *min*s
-result in shorter, more frequent garbage collections.
+be satisfied with having after it is done each time. Initially it is
+8192 words. If the total amount of reclaimed storage is less than
+*min*, the garbage collector will ask the operating system for enough
+storage (in 1024-word blocks) to make it up. N.B.: the system may be
+incivil enough not to grant the request; in that case, the garbage
+collector will be content with what it has, **unless** that is not
+enough to satisfy a **pending** request for storage. Then it will
+inform you that it is losing. A large *min* will result in fewer total
+garbage collections, but they will take longer since the total
+quantity of storage to be dealt with will generally be larger. Smaller
+*min*s result in shorter, more frequent garbage collections.
+
+*exh?* tells whether or not this garbage collection should be
+"exhaustive". It is optional, a `FALSE` by default. The difference
+between normal and exhaustive "copying" garbage collections is whether
+certain kinds of storage that require complicated treatment (for
+example, associations) are reclaimed. An exhaustive garbage collection
+occurs every eighth time that the "copying" algorithm is used, or when
+`GC` is called with this argument true, or when a normal garbage
+collection cannot satisfy the storage request.
+
+*ms-freq* gives the number of times the "mark-sweep" algorithm should
+be used hereafter for every time the normal "copying" algorithm is
+used. Giving `0` for *ms-freq* means never to use the "mark-sweep"
+algorithm, and giving `<CHTYPE <MIN> FIX>` means (effectively) always
+to use it. The "mark-sweep" algorithm uses considerably less processor
+time than the "copying" algorithm, but it never shrinks the
+free-storage pool, and in fact the pool can become fragmented. The
+"mark-sweep" algorithm could be useful in a program system (such as
+the compiler) where the size of the pool rarely changes, but objects
+are created and thrown away continuously.
22.6. BLOAT
-----------
`READ`ing large `STRING`s, and calling routines within the
interpreter and compiled programs)
-Arguments on the second line are also `FIX` and optional, but they set
-garbage-collection parameters permanently, as follows:
+Arguments on the second line above are also `FIX` and optional, but
+they set garbage-collection parameters permanently, as follows:
- *min*: as for `GC`
- *plcl*: number of slots for `LVAL`s added when the space for
22.8. GC-MON
------------
- <GC-MOND pred>
+ <GC-MON pred>
("garbage-collector monitor") determines whether or not the
interpreter will hereafter print information on the terminal when a
Two `SUBR`s, described next, use only part of the garbage-collector
algorithm, in order to find all pointers to an object. `GC-DUMP` and
`GC-READ`, as their names imply, also use part in order to translate
-between Muddle objects and binary representation thereof.
+between Muddle objects and binary representations thereof.
### 22.9.1. SUBSTITUTE
the "wrong" one, after `OBLIST`s have been in the wrong state. This is
more or less the way `ATOM`s are impurified. It is also useful for
unlinking `RSUBR`s. `SUBSTITUTE` returns *old* as a favor: unless you
-hang onto *old* at that point, it will be garbage-collected.
+hang onto *old* at that point, it will be garbage.
22.9.2 PURIFY
-------------