Aaron suggested I was being a little cryptic (death watch beetle?) in what
I said about stacks and associativity. Well, lets try to expand a little.
A constructor function, being an operation of a free algebra, is
non-associative. This means that our favourite mapping functions (e.g.
maplist) are homomorphisms of free algebras determined therefore entirely
by operations on the generators. However some important computational
constructs (e.g. program source text) are semigroups under some operation
(e.g. concatenation). If you are going to serialise a structure (e.g. a
when you translate a thought into a sentence that you utter) you typically
need to map into such a semigroup. And the stack provides just the right
mechanism. E.g. a procedure to translate an applicative structure to the
source for a language L might have the form in POP-11
translate_to_L(functor(E)), translate_to_L(arg(E))
where each call pushes source code on the stack.
Robin.
|