Doug McIlroy <doug(a)cs.dartmouth.edu> wrote:
> Even
high-school employees could make lasting contributions. I am
> indebted to Steve for a technique he conceived during his first summer
> assignment: using macro definitions as if they were units of associative
> memory. This view of macros stimulated previously undreamed-of uses.
Can you give some examples of what this looked
like?
One useless, but telling, program of mine was a Turing-machine
simulator. Tape cells were represented by macros that contained
a symbol and the (macro) names of adjacent cells. New cells
could be generated as needed, with names derived from a counter.
A natural way to store the state-transition table (I forget
how it was actually done) would be as macros whose names
are the concatenation of state and symbol names.
Path-compression as used in union-find algorithms originated
in a macroprocessor implementation by Bob Morris. Each graph
node was represented by a macro that pointed to or toward
the root of a tree spanning its graph component.
Thanks Doug.
I have to admit, I didn't really grok this. My mental processes
seem to have frozen somewhat and I need to see something like this
in code before I really understand it. :-)
Thanks,
Arnold