17.05.2015 Views

zl:1 - FTP

zl:1 - FTP

zl:1 - FTP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

263 g-I-p<br />

Of course, globalize cannot cause two distinct symbols to become eq. Its<br />

conflict resolution techniques are useful only for symbols that are used as<br />

names for things like functions and variables, not for symbols that are used<br />

for their own sake. You can sometimes get the desired effect by using one<br />

of the conflicting symbols as the first argument to globalize, rather than<br />

using a string.<br />

For example, suppose a program in the color package deals with colors by<br />

symbolic names, perhaps using <strong>zl</strong>:selectq to test for such symbols as red,<br />

green, and yellow. Suppose there is also a function named red in the<br />

math package and someone decides that this function is generally useful<br />

and should be made global. Doing (globalize 'color:red) ensures that the<br />

exported symbol is the one that the color program is looking for; this<br />

means that every package except the math package sees the right symbol<br />

to use if it wants to call the color program. Programs that call the red<br />

function do not care which of the two symbols they use as the name of the<br />

function, since both symbols have the same definition. Usually the situation<br />

described in this example would not arise, because standard programming<br />

style dictates that the color program should have been using<br />

keywords for this application.<br />

globalize returns two values. The first is the chosen symbol and the<br />

second is a (possibly empty) list of all the symbols whose value, function,<br />

and property cells were forwarded to the cells of the chosen symbol.<br />

To disable the messages printed by globalize, bind <strong>zl</strong>:error-output to a<br />

null stream (one that throws away all output). For example:<br />

(let «<strong>zl</strong> : error-output 'si:null-stream»<br />

(globalize 'rumpelstiltskin»<br />

g-l-p array Function<br />

If array has a fill pointer, g-l-p returns a list that stops at the fill pointer,<br />

if you never modify the fill-pointer except with <strong>zl</strong>:array-push, <strong>zl</strong>:array-pop<br />

and so on. array must be a general (sys:art-q-list) array. Example:<br />

(setq a (<strong>zl</strong> :make-array 4 :type 'art-q-list»<br />

(aref a 8) => nil<br />

(setq b (g-l-p a» => (nil nil nil nil)<br />

(setf (car b) t)<br />

b => (t nil nil nil)<br />

(aref a 8) => t<br />

(setf (aref a 2) 38)<br />

b => (t nil 38 nil)

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!