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.

<strong>zl</strong>:memass 346<br />

I<br />

parison instead of eq. (<strong>zl</strong>:mem 'eq a b) is the same as (<strong>zl</strong>:memq a b).<br />

(<strong>zl</strong>:mem 'equal a b) is the same as (<strong>zl</strong>:member a b).<br />

<strong>zl</strong>:mem is usually used with equality predicates other than eq and <strong>zl</strong>:equal,<br />

such as =, char-equal or <strong>zl</strong>:string-equal. It can also be used with noncommutative<br />

predicates. The predicate is called with item as its first argument<br />

and the element of list as its second argument, so:<br />

(<strong>zl</strong> :mem #'< 4 list)<br />

fmds the first element in list for which « 4 x) is true; that is, it finds the<br />

first element greater than 4.<br />

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

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

<strong>zl</strong>:memass predicate item alist Function<br />

(<strong>zl</strong>:memass item alist) looks up item in the association list (list of conses)<br />

alist. The value returned is the portion of the list beginning with the pair<br />

containing the first element that matches item, according to predicate, or<br />

nil if there is none such.<br />

(car (<strong>zl</strong>:memass x y z» = (<strong>zl</strong>:ass x y z).<br />

See the function <strong>zl</strong>:mem, page 345. As with <strong>zl</strong>:mem, you can use noncommutative<br />

predicates; the first argument to the predicate is item and the<br />

second is the key of the element of alist.<br />

For a table of related items: See the section "Functions That Operate on<br />

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

member item list &key (test #'eql) test-not (key #'identity) Function<br />

. member searches list for an element that satisfies the predicate specified<br />

by the :test keyword with respect to item. If no element is found that<br />

matches item, nil is returned; otherwise the tail of list beginning with the<br />

first element that satisfied the predicate is returned. The keywords are:<br />

:test<br />

:test-not<br />

:key<br />

Any predicate specifying a binary operation to be applied<br />

to a supplied argument and an element of a target list.<br />

The item matches the specification only if the predicate<br />

returns t. If :test is not supplied the default operation is<br />

eql.<br />

Similar to :test, except the item matches the specification<br />

only if there is an element of the list for which the<br />

predicate returns nil.<br />

If not nil, should be a function of one argument that will<br />

extract from an element the part to be tested in place of<br />

the whole element.

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

Saved successfully!

Ooh no, something went wrong!