< Previous | Contents | Next >

Circular Lists

If your program is creating circular lists, a lot of space may be wasted. (Many

crosslinked data structures end up having circularities.) Hints when using circular lists:

• Write a function to remove pointers that make lists circular when you are through with the circular list.

• If you are working with circular lists of windows, bind your main window to a unique global variable. Write window creation conditionally so that if the binding of that

variable is already a window, use it, and only create a new window if that variable is unbound or NIL.

Here is an example that illustrates the problem. When several auxilIary windows are built, pointers to these windows are usually kept on the main window’s property list.

Each auxilIary window also typically keeps a pointer to the main window on its

property list If the top level function creates windows rather than reusing existing ones, there will be many lists of useless windows cluttering the work space. Or, if such a main window is closed and will not be used again, you will have to break the links by deleting the relevant properties from both the main window and all of the auxiliary windows

first. This is usually done by putting a special CLOSEFN on the main window and all of its auxiliary windows.