1
0
Fork 0
cl-sites/novaspec.org/cl/17_2_Rules_about_Test_Functions.html

1165 lines
26 KiB
HTML
Raw Normal View History

2025-02-05 18:52:26 +01:00
<!DOCTYPE HTML>
<HTML LANG="en-us"
><HEAD
><TITLE
>17.2 Rules about Test Functions | Common Lisp Nova Spec</TITLE
><META CHARSET="US-ASCII"
><LINK REL="canonical" HREF="17_2_Rules_about_Test_Functions.html"
><LINK REL="next" HREF="17_3_Sequences_Dictionary.html" TYPE="text/html" TITLE="17.3 Sequences Dictionary"
><LINK REL="prev" HREF="17_1_Sequence_Concepts.html" TYPE="text/html" TITLE="17.1 Sequence Concepts"
><LINK REL="up" HREF="17_Sequences.html" TYPE="text/html" TITLE="17. Sequences"
><LINK REL="start" HREF="index.html" TYPE="text/html" TITLE="Common Lisp Nova Spec"
><META NAME="VIEWPORT" CONTENT="width=device-width, initial-scale=1.0"
><LINK REL="STYLESHEET" HREF="dpans.css%3F3909942064.css"
><SCRIPT SRC="dpans.js%3F3909942064"
></SCRIPT
><SCRIPT SRC="apropos.js%3F3909942064"
></SCRIPT
></HEAD
><BODY
><DIV
><DIV CLASS="topnav"
><DIV CLASS="breadcrumb"
><SPAN CLASS="breadcrumb-item"
><A HREF="index.html"
>Common Lisp Nova Spec</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="17_Sequences.html"
>17. Sequences</A
></SPAN
> <SPAN CLASS="breadcrumb-item"
>&#8594; <A HREF="17_2_Rules_about_Test_Functions.html"
>17.2 Rules about Test Functions</A
></SPAN
></DIV
><DIV CLASS="apropos"
><DIV CLASS="apropos-io"
><A HREF="17_1_Sequence_Concepts.html" CLASS="prev"
>&#8592;</A
><SPAN ID="apropos-label"
>Apropos </SPAN
><INPUT ID="apropos" AUTOFOCUS="AUTOFOCUS" PLACEHOLDER="Type here to search" ONINPUT="aproposInput(this);" ONKEYUP="aproposKeyup(event);" ONCHANGE="aproposChange(this);" ONFOCUS="aproposFocus(this);" ONFOCUSOUT="aproposFocusout(this);"
><A HREF="17_3_Sequences_Dictionary.html" CLASS="next"
>&#8594;</A
></DIV
><DIV ID="apropos-res"
></DIV
></DIV
></DIV
><DIV CLASS="matter"
><SECTION
><H2 ID="sec_17_2" CLASS="HeadII"
>17.2 Rules about Test Functions</H2
><UL CLASS="subtoc"
><LI
><A HREF="17_2_Rules_about_Test_Functions.html#sec_17_2_1"
>17.2.1 Satisfying a Two-Argument Test</A
></LI
><LI
><A HREF="17_2_Rules_about_Test_Functions.html#sec_17_2_1_1"
>17.2.1.1 Examples of Satisfying a Two-Argument Test</A
></LI
><LI
><A HREF="17_2_Rules_about_Test_Functions.html#sec_17_2_2"
>17.2.2 Satisfying a One-Argument Test</A
></LI
><LI
><A HREF="17_2_Rules_about_Test_Functions.html#sec_17_2_2_1"
>17.2.2.1 Examples of Satisfying a One-Argument Test</A
></LI
></UL
><H3 ID="sec_17_2_1" CLASS="HeadIII"
>17.2.1 Satisfying a Two-Argument Test</H3
><P CLASS="j"
>When an <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> <I
>O</I
> is being considered iteratively against each <A HREF="26_1_Glossary.html#element"
><EM CLASS="term"
>element</EM
></A
> <I
>E</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> of a <A HREF="26_1_Glossary.html#sequence"
><EM CLASS="term"
>sequence</EM
></A
> <I
>S</I
> by an <A HREF="26_1_Glossary.html#operator"
><EM CLASS="term"
>operator</EM
></A
> <I
>F</I
> listed in Figure 17&#8211;2, it is sometimes useful to control the way in which the presence of <I
>O</I
> is tested in <I
>S</I
> is tested by <I
>F</I
>. This control is offered on the basis of a <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> designated with either a <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:test</SPAN
></SPAN
> or <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:test-not</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
>.</P
><DIV CLASS="displaythree"
><FIGURE CLASS="boxfig"
><DIV CLASS="figbody"
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0" WIDTH="100%"
><TBODY
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
><A HREF="f_adjoin.html" CLASS="misc"
><B
>adjoin</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_set-exclusive-or.html" CLASS="misc"
><B
>nset-exclusive-or</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_search.html" CLASS="misc"
><B
>search</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_assoc.html" CLASS="misc"
><B
>assoc</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_sublis.html" CLASS="misc"
><B
>nsublis</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_set-difference.html" CLASS="misc"
><B
>set-difference</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_count.html" CLASS="misc"
><B
>count</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_subst.html" CLASS="misc"
><B
>nsubst</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_set-exclusive-or.html" CLASS="misc"
><B
>set-exclusive-or</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_remove.html" CLASS="misc"
><B
>delete</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_substitute.html" CLASS="misc"
><B
>nsubstitute</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_sublis.html" CLASS="misc"
><B
>sublis</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_find.html" CLASS="misc"
><B
>find</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_union.html" CLASS="misc"
><B
>nunion</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_subsetp.html" CLASS="misc"
><B
>subsetp</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_intersection.html" CLASS="misc"
><B
>intersection</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_position.html" CLASS="misc"
><B
>position</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_subst.html" CLASS="misc"
><B
>subst</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <SPAN CLASS="misc"
><B
>member</B
></SPAN
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_pushnew.html" CLASS="misc"
><B
>pushnew</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_substitute.html" CLASS="misc"
><B
>substitute</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_mismatch.html" CLASS="misc"
><B
>mismatch</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_rassoc.html" CLASS="misc"
><B
>rassoc</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_tree-equal.html" CLASS="misc"
><B
>tree-equal</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_intersection.html" CLASS="misc"
><B
>nintersection</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_remove.html" CLASS="misc"
><B
>remove</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_union.html" CLASS="misc"
><B
>union</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_set-difference.html" CLASS="misc"
><B
>nset-difference</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_remove-duplicates.html" CLASS="misc"
><B
>remove-duplicates</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
><SPAN CLASS="misc"
></SPAN
></TD
></TR
></TBODY
></TABLE
></DIV
><FIGCAPTION CLASS="caption"
><B
>Figure 17&#8211;2. Operators that have Two-Argument Tests to be Satisfied</B
></FIGCAPTION
></FIGURE
></DIV
><P CLASS="j"
>The object <I
>O</I
> might not be compared directly to <I
>E</I
><SUB CLASS="sub"
><I
>i</I
></SUB
>. If a <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:key</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> is provided, it is a <A HREF="26_1_Glossary.html#designator"
><EM CLASS="term"
>designator</EM
></A
> for a <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> of one <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> to be called with each <I
>E</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> as an <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
>, and <A HREF="26_1_Glossary.html#yield"
><EM CLASS="term"
>yielding</EM
></A
> an <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> <I
>Z</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> to be used for comparison. (If there is no <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:key</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
>, <I
>Z</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> is <I
>E</I
><SUB CLASS="sub"
><I
>i</I
></SUB
>.) </P
><P CLASS="j"
>The <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> designated by the <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:key</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> is never called on <I
>O</I
> itself. However, if the function operates on multiple sequences (<I CLASS="i"
><I
>e.g.</I
></I
>, as happens in <A HREF="f_set-difference.html" CLASS="funref"
><B
>set-difference</B
></A
>), <I
>O</I
> will be the result of calling the <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:key</SPAN
></SPAN
> function on an <A HREF="26_1_Glossary.html#element"
><EM CLASS="term"
>element</EM
></A
> of the other sequence. </P
><P CLASS="j"
>A <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:test</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
>, if supplied to <I
>F</I
>, is a <A HREF="26_1_Glossary.html#designator"
><EM CLASS="term"
>designator</EM
></A
> for a <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> of two <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>arguments</EM
></A
>, <I
>O</I
> and <I
>Z</I
><SUB CLASS="sub"
><I
>i</I
></SUB
>. An <I
>E</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> is said (or, sometimes, an <I
>O</I
> and an <I
>E</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> are said) to <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>satisfy</SPAN
> <SPAN CLASS="cmbxsl"
>the</SPAN
> <SPAN CLASS="cmbxsl"
>test</SPAN
></DFN
> <SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="satisfy the test"
></SPAN
>if this <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:test</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> returns a <A HREF="26_1_Glossary.html#generalized_boolean"
><EM CLASS="term"
>generalized boolean</EM
></A
> representing <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
>. </P
><P CLASS="j"
>A <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:test-not</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
>, if supplied to <I
>F</I
>, is <A HREF="26_1_Glossary.html#designator"
><EM CLASS="term"
>designator</EM
></A
> for a <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> of two <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>arguments</EM
></A
>, <I
>O</I
> and <I
>Z</I
><SUB CLASS="sub"
><I
>i</I
></SUB
>. An <I
>E</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> is said (or, sometimes, an <I
>O</I
> and an <I
>E</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> are said) to <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>satisfy</SPAN
> <SPAN CLASS="cmbxsl"
>the</SPAN
> <SPAN CLASS="cmbxsl"
>test</SPAN
></DFN
> <SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="satisfy the test"
></SPAN
>if this <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:test-not</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> returns a <A HREF="26_1_Glossary.html#generalized_boolean"
><EM CLASS="term"
>generalized boolean</EM
></A
> representing <A HREF="26_1_Glossary.html#false"
><EM CLASS="term"
>false</EM
></A
>. </P
><P CLASS="j"
>If neither a <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:test</SPAN
></SPAN
> nor a <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:test-not</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> is supplied, it is as if a <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:test</SPAN
></SPAN
> argument of <CODE CLASS="f"
>#'eql</CODE
> was supplied. </P
><P CLASS="j"
>The consequences are unspecified if both a <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:test</SPAN
></SPAN
> and a <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:test-not</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> are supplied in the same <A HREF="26_1_Glossary.html#call"
><EM CLASS="term"
>call</EM
></A
> to <I
>F</I
>.</P
><H4 ID="sec_17_2_1_1" CLASS="HeadIV"
>17.2.1.1 Examples of Satisfying a Two-Argument Test</H4
><PRE CLASS="screen"
> (remove "FOO" '(foo bar "FOO" "BAR" "foo" "bar") :test #'equal)
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (foo bar "BAR" "foo" "bar")
(remove "FOO" '(foo bar "FOO" "BAR" "foo" "bar") :test #'equalp)
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (foo bar "BAR" "bar")
(remove "FOO" '(foo bar "FOO" "BAR" "foo" "bar") :test #'string-equal)
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (bar "BAR" "bar")
(remove "FOO" '(foo bar "FOO" "BAR" "foo" "bar") :test #'string=)
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (BAR "BAR" "foo" "bar")
(remove 1 '(1 1.0 #C(1.0 0.0) 2 2.0 #C(2.0 0.0)) :test-not #'eql)
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (1)
(remove 1 '(1 1.0 #C(1.0 0.0) 2 2.0 #C(2.0 0.0)) :test-not #'=)
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (1 1.0 #C(1.0 0.0))
(remove 1 '(1 1.0 #C(1.0 0.0) 2 2.0 #C(2.0 0.0)) :test (complement #'=))
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (1 1.0 #C(1.0 0.0))
(count 1 '((one 1) (uno 1) (two 2) (dos 2)) :key #'cadr) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 2
(count 2.0 '(1 2 3) :test #'eql :key #'float) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 1
(count "FOO" (list (make-pathname :name "FOO" :type "X")
(make-pathname :name "FOO" :type "Y"))
:key #'pathname-name
:test #'equal)
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 2</PRE
><H3 ID="sec_17_2_2" CLASS="HeadIII"
>17.2.2 Satisfying a One-Argument Test</H3
><P CLASS="j"
>When using one of the <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>functions</EM
></A
> in Figure 17&#8211;3, the elements <I
>E</I
> of a <A HREF="26_1_Glossary.html#sequence"
><EM CLASS="term"
>sequence</EM
></A
> <I
>S</I
> are filtered not on the basis of the presence or absence of an object <I
>O</I
> under a two <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> <A HREF="26_1_Glossary.html#predicate"
><EM CLASS="term"
>predicate</EM
></A
>, as with the <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>functions</EM
></A
> described in <A HREF="17_2_Rules_about_Test_Functions.html#sec_17_2_1" CLASS="secref"
><SPAN CLASS="cmr"
>Section</SPAN
> <SPAN CLASS="cmr"
>17.2.1</SPAN
> <SPAN CLASS="cmr"
>(Satisfying</SPAN
> <SPAN CLASS="cmr"
>a</SPAN
> <SPAN CLASS="cmr"
>Two-Argument</SPAN
> <SPAN CLASS="cmr"
>Test)</SPAN
></A
>, but rather on the basis of a one <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> <A HREF="26_1_Glossary.html#predicate"
><EM CLASS="term"
>predicate</EM
></A
>.</P
><DIV CLASS="displaythree"
><FIGURE CLASS="boxfig"
><DIV CLASS="figbody"
><TABLE CELLSPACING="0" CELLPADDING="0" RULES="GROUPS" STYLE="margin: 1ex 0" WIDTH="100%"
><TBODY
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
><A HREF="f_assoc.html" CLASS="misc"
><B
>assoc-if</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_member.html" CLASS="misc"
><B
>member-if</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_rassoc.html" CLASS="misc"
><B
>rassoc-if</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_assoc.html" CLASS="misc"
><B
>assoc-if-not</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_member.html" CLASS="misc"
><B
>member-if-not</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_rassoc.html" CLASS="misc"
><B
>rassoc-if-not</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_count.html" CLASS="misc"
><B
>count-if</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_subst.html" CLASS="misc"
><B
>nsubst-if</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_remove.html" CLASS="misc"
><B
>remove-if</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_count.html" CLASS="misc"
><B
>count-if-not</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_subst.html" CLASS="misc"
><B
>nsubst-if-not</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_remove.html" CLASS="misc"
><B
>remove-if-not</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_remove.html" CLASS="misc"
><B
>delete-if</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_substitute.html" CLASS="misc"
><B
>nsubstitute-if</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_subst.html" CLASS="misc"
><B
>subst-if</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_remove.html" CLASS="misc"
><B
>delete-if-not</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_substitute.html" CLASS="misc"
><B
>nsubstitute-if-not</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_subst.html" CLASS="misc"
><B
>subst-if-not</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_find.html" CLASS="misc"
><B
>find-if</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_position.html" CLASS="misc"
><B
>position-if</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_substitute.html" CLASS="misc"
><B
>substitute-if</B
></A
></TD
></TR
><TR
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE=";padding-right:1em"
> <A HREF="f_find.html" CLASS="misc"
><B
>find-if-not</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;padding-right:1em"
> <A HREF="f_position.html" CLASS="misc"
><B
>position-if-not</B
></A
></TD
><TD ALIGN="LEFT" VALIGN="BASELINE" NOWRAP="NOWRAP" STYLE="padding-left:1em;"
> <A HREF="f_substitute.html" CLASS="misc"
><B
>substitute-if-not</B
></A
></TD
></TR
></TBODY
></TABLE
></DIV
><FIGCAPTION CLASS="caption"
><B
>Figure 17&#8211;3. Operators that have One-Argument Tests to be Satisfied</B
></FIGCAPTION
></FIGURE
></DIV
><P CLASS="j"
>The element <I
>E</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> might not be considered directly. If a <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:key</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> is provided, it is a <A HREF="26_1_Glossary.html#designator"
><EM CLASS="term"
>designator</EM
></A
> for a <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> of one <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> to be called with each <I
>E</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> as an <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
>, and <A HREF="26_1_Glossary.html#yield"
><EM CLASS="term"
>yielding</EM
></A
> an <A HREF="26_1_Glossary.html#object"
><EM CLASS="term"
>object</EM
></A
> <I
>Z</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> to be used for comparison. (If there is no <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:key</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
>, <I
>Z</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> is <I
>E</I
><SUB CLASS="sub"
><I
>i</I
></SUB
>.) </P
><P CLASS="j"
><A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>Functions</EM
></A
> defined in this specification and having a name that ends in &#8220;<CODE CLASS="f"
>-if</CODE
>&#8221; accept a first <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> that is a <A HREF="26_1_Glossary.html#designator"
><EM CLASS="term"
>designator</EM
></A
> for a <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> of one <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
>, <I
>Z</I
><SUB CLASS="sub"
><I
>i</I
></SUB
>. An <I
>E</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> is said to <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>satisfy</SPAN
> <SPAN CLASS="cmbxsl"
>the</SPAN
> <SPAN CLASS="cmbxsl"
>test</SPAN
></DFN
> <SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="satisfy the test"
></SPAN
>if this <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:test</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> returns a <A HREF="26_1_Glossary.html#generalized_boolean"
><EM CLASS="term"
>generalized boolean</EM
></A
> representing <A HREF="26_1_Glossary.html#true"
><EM CLASS="term"
>true</EM
></A
>. </P
><P CLASS="j"
><A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>Functions</EM
></A
> defined in this specification and having a name that ends in &#8220;<CODE CLASS="f"
>-if-not</CODE
>&#8221; accept a first <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
> that is a <A HREF="26_1_Glossary.html#designator"
><EM CLASS="term"
>designator</EM
></A
> for a <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> of one <A HREF="26_1_Glossary.html#argument"
><EM CLASS="term"
>argument</EM
></A
>, <I
>Z</I
><SUB CLASS="sub"
><I
>i</I
></SUB
>. An <I
>E</I
><SUB CLASS="sub"
><I
>i</I
></SUB
> is said to <DFN CLASS="newterm"
><SPAN CLASS="cmbxsl"
>satisfy</SPAN
> <SPAN CLASS="cmbxsl"
>the</SPAN
> <SPAN CLASS="cmbxsl"
>test</SPAN
></DFN
> <SPAN CLASS="idx" DATA-KIND="idxterm" DATA-TERM="satisfy the test"
></SPAN
>if this <SPAN CLASS="kwd"
><SPAN CLASS="cmtt"
>:test</SPAN
></SPAN
> <A HREF="26_1_Glossary.html#function"
><EM CLASS="term"
>function</EM
></A
> returns a <A HREF="26_1_Glossary.html#generalized_boolean"
><EM CLASS="term"
>generalized boolean</EM
></A
> representing <A HREF="26_1_Glossary.html#false"
><EM CLASS="term"
>false</EM
></A
>.</P
><H4 ID="sec_17_2_2_1" CLASS="HeadIV"
>17.2.2.1 Examples of Satisfying a One-Argument Test</H4
><PRE CLASS="screen"
> (count-if #'zerop '(1 #C(0.0 0.0) 0 0.0d0 0.0s0 3)) <SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 4
(remove-if-not #'symbolp '(0 1 2 3 4 5 6 7 8 9 A B C D E F))
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (A B C D E F)
(remove-if (complement #'symbolp) '(0 1 2 3 4 5 6 7 8 9 A B C D E F))
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> (A B C D E F)
(count-if #'zerop '("foo" "" "bar" "" "" "baz" "quux") :key #'length)
<SPAN CLASS="cmsy"
><SPAN CLASS="arrow"
>&#8594;</SPAN
></SPAN
> 3</PRE
></SECTION
></DIV
><DIV CLASS="footer"
><DIV CLASS="btmnav"
><A HREF="17_1_Sequence_Concepts.html" CLASS="prev"
>&#8592;</A
><A HREF="17_3_Sequences_Dictionary.html" CLASS="next"
>&#8594;</A
></DIV
><DIV CLASS="trail"
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
></DIV
></DIV
><SCRIPT
>domReady();</SCRIPT
></BODY
></HTML
>