100 lines
3.3 KiB
HTML
100 lines
3.3 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
||
|
<!Originally converted to HTML using LaTeX2HTML 95 (Thu Jan 19 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
||
|
<HEAD>
|
||
|
<TITLE> member (FUNCTION)</TITLE>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<meta name="description" value=" member (FUNCTION)">
|
||
|
<meta name="keywords" value="lp">
|
||
|
<meta name="resource-type" value="document">
|
||
|
<meta name="distribution" value="global">
|
||
|
<P>
|
||
|
<BR> <HR>
|
||
|
<A HREF="node104.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A>
|
||
|
<A HREF="node72.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A>
|
||
|
<A HREF="node102.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <BR>
|
||
|
<A HREF="lp.html"><B>Contents</B></A>
|
||
|
<B> Next:</B>
|
||
|
<A HREF="node104.html"> not (PREDICATE)</A>
|
||
|
<B>Up:</B>
|
||
|
<A HREF="node72.html"> Appendix: Selected Lisp </A>
|
||
|
<B> Previous:</B>
|
||
|
<A HREF="node102.html"> maxmin (FUNCTIONS)</A>
|
||
|
<BR> <HR> <P>
|
||
|
<H1> member (FUNCTION)</H1>
|
||
|
<P>
|
||
|
<b> Format:</b>
|
||
|
<tt> (member <item> <list> </tt>
|
||
|
<tt> :test <test> </tt>
|
||
|
<tt> :test-not <test-not> </tt>
|
||
|
<tt> :key <key> )</tt>
|
||
|
<P>
|
||
|
<b> Required arguments:</b>
|
||
|
2
|
||
|
<P>
|
||
|
<tt> <item> </tt>: Any Lisp expression
|
||
|
<tt> <list> </tt>: A expression which returns a list
|
||
|
<P>
|
||
|
<b> Keyword arguments:</b>
|
||
|
3
|
||
|
<P>
|
||
|
<tt> <test> /<test-not> </tt>: A function or lambda expression that
|
||
|
can be applied to compare <tt> <item> </tt> with elements of <tt> <list> </tt>.
|
||
|
<tt> <key> </tt>: A function or lambda expression that can be applied
|
||
|
to elements of <tt> <list> </tt>.
|
||
|
<P>
|
||
|
The elements of <tt> <list> </tt> are compared with the <tt> <item> </tt>. If
|
||
|
<tt> <test> </tt> is not specified, eq is used; otherwise <tt> <test> </tt> is used.
|
||
|
If <tt> <item> </tt> is found to match an element of <tt> <list> </tt>, a list containing
|
||
|
all the elements from <tt> <item> </tt> to the end of <tt> <list> </tt> is returned.
|
||
|
Otherwise NIL is returned. If <tt> <test-not> </tt> is specified, member
|
||
|
returns a list beginning with the first UNmatched element of <tt> <list> </tt>.
|
||
|
Specifying a <tt> <key> </tt> causes member to compare <tt> <item> </tt> with the
|
||
|
result of applying <tt> <key> </tt> to each element of <tt> <list> </tt>, rather than
|
||
|
to the element itself.
|
||
|
<P>
|
||
|
<b> Examples:</b>
|
||
|
<P>
|
||
|
<BLOCKQUOTE>
|
||
|
<PRE>> (member 'riker '(picard riker worf crusher))
|
||
|
(RIKER WORF CRUSHER)
|
||
|
|
||
|
> (member '(lieutenant worf)
|
||
|
'((captain picard)
|
||
|
(commander riker)
|
||
|
(lieutenant worf)
|
||
|
(ensign crusher)))
|
||
|
NIL
|
||
|
</PRE>
|
||
|
</BLOCKQUOTE>
|
||
|
<P>
|
||
|
<BLOCKQUOTE>
|
||
|
<PRE>> (member '(lieutenant worf)
|
||
|
'((captain picard)
|
||
|
(commander riker)
|
||
|
(lieutenant worf)
|
||
|
(ensign crusher))
|
||
|
:test #'equal)
|
||
|
((LIEUTENANT WORF) (ENSIGN CRUSHER))
|
||
|
|
||
|
> (member 'picard '(picard riker worf crusher) :test-not #'eq)
|
||
|
(RIKER WORF CRUSHER)
|
||
|
|
||
|
> (member 'worf
|
||
|
'((captain picard)
|
||
|
(commander riker)
|
||
|
(lieutenant worf)
|
||
|
(ensign crusher))
|
||
|
:key #'second)
|
||
|
((LIEUTENANT WORF) (ENSIGN CRUSHER))
|
||
|
</PRE>
|
||
|
</BLOCKQUOTE>
|
||
|
<P>
|
||
|
<BR> <HR>
|
||
|
<P>
|
||
|
<ADDRESS>
|
||
|
<I>© Colin Allen & Maneesh Dhagat <BR>
|
||
|
March 2007 </I>
|
||
|
</ADDRESS>
|
||
|
</BODY>
|