17.05.2015 Views

zl:1 - FTP

zl:1 - FTP

zl:1 - FTP

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

count-if-not 122<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 />

(count-if #'atom '«a b) «a) b) (nil nil» :key #'car) => 2<br />

I<br />

(count-if #'zerop #(1 2 1) :key #'(lambda (x) (- x 1») => 2<br />

The :from-end argument does not affect the result returned; it is accepted<br />

purely for compatibility with other sequence functions.<br />

For example:<br />

(count-if #'oddp '(1 1 2 2) :start 2 :from-end t) => B<br />

(count-if #'oddp '(1 1 2 2) :start 2 :from-end nil) => B<br />

For the sake of efficiency, you can delimit the portion of the sequence to be<br />

operated on by the keyword arguments :start and :end.<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:<br />

(count-if #'oddp '(1 2 1 2» => 2<br />

(count-if #'oddp '(1 1 1 222) :start 2 :end 4) =><br />

(count-if #'numberp , (heron 1.B a 2 #\Space» => 2<br />

For a table of related items: See the section "Searching for Sequence<br />

Items" in Symbolics Common Lisp: Language Concepts.<br />

count-if-not predicate sequence &key key from-end (start 0) end Function<br />

count-if-not returns a non-negative integer, which represents the number<br />

of elements in the specified subsequence of sequence that do not satisfy the<br />

predicate.

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

Saved successfully!

Ooh no, something went wrong!