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.

nsubstitute-if-not<br />

380<br />

I<br />

However,<br />

(setq numbers '(9 9 9» => (9 9 9)<br />

(nsubstitute-if-not 1 #'numberp numbers) => (9 9 9)<br />

numbers => (9 9 9)<br />

numbers => (1 9 9)<br />

(nsubstitute-if-not 2 #'consp numbers) => (2 2 2)<br />

numbers => (2 2 2)<br />

newitem can be any Symbolics Common Lisp object but must be a suitable<br />

element for the sequence.<br />

predicate is the test to be performed on each element.<br />

sequence can be either a list or a vector (one-dimensional array). Note that<br />

nil is considered to be a sequence, of length zero.<br />

The value of the keyword argument : key, if non-nil, is a function that<br />

takes one argument. This function extracts from each element the part to<br />

be tested in place of the whole element.<br />

For example:<br />

(nsubstitute-if-not 1 #'oddp '«1 1) (1 2) (4 3»<br />

=> «1 1) 1 (4 3»)<br />

:key #'second)<br />

A non-nil :from-end specification matters only when the :count argument<br />

is provided; in that case only the rightmost :count elements satisfying the<br />

test are replaced.<br />

For example:<br />

(nsubstitute-if-not 'hi #'atom '('b a 'b) :from-end t :count 1 )<br />

=> ('8 A HI)<br />

Use the keyword arguments :start and :end to delimit the portion of the<br />

sequence to be operated on.<br />

:start and :end must be non-negative integer indices into the sequence.<br />

:start must be less than or equal to :end, else an error is signalled. It<br />

defaults to zero (the start of the sequence).<br />

:start indicates the start position for the operation within the sequence.<br />

:end indicates the position of the first element in the sequence beyond the<br />

end of the operation. It defaults to nil (the length of the sequence).<br />

If both :start and :end are omitted, the entire sequence is processed by<br />

default.<br />

For example:

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

Saved successfully!

Ooh no, something went wrong!