next up previous contents
Next: Defining updaters Up: CHAPTER.3: PROCEDURES AND Previous: Using a numerical

updaters, the stack and "explode"

Typically an updater procedure, like the updater of hd, removes one item from the top of the stack, and stores it somewhere. Pop-11 updaters are not required to remove exactly one item. For example, if you have a three element list or vector it can be used to store three items from the top of the stack using the updater of the procedure explode, as explained below.

Explode itself puts all the elements of a structure on the stack:

    vars vec = {a b c};
    explode(vec) =>     ;;; put all the elements of vec on the stack
    ** a b c
This leaves vec unchanged.

    vec =>
    ** {a b c}
We can use the updater of explode to take three things off the top of the stack and store them in vec:

    [list 1] , [list 2], [list 3] -> explode(vec);
    vec =>
    ** {[list 1] [list 2] [list 3]}
So vec is now a vector containing three lists instead of three words.

The procedure "fill" is similar to the updater of explode, but also returns the "filled" datastructure as its result. See HELP FILL)



Aaron Sloman
Fri Jan 2 03:17:44 GMT 1998