280 lines
No EOL
5.2 KiB
HTML
280 lines
No EOL
5.2 KiB
HTML
<!DOCTYPE HTML>
|
|
<HTML LANG="en-us"
|
|
><HEAD
|
|
><TITLE
|
|
>nthcdr | Common Lisp Nova Spec</TITLE
|
|
><META CHARSET="US-ASCII"
|
|
><LINK REL="canonical" HREF="f_nthcdr.html"
|
|
><LINK REL="next" HREF="f_rest.html" TYPE="text/html" TITLE="rest"
|
|
><LINK REL="prev" HREF="f_ldiff.html" TYPE="text/html" TITLE="ldiff, tailp"
|
|
><LINK REL="up" HREF="14_2_Conses_Dictionary.html" TYPE="text/html" TITLE="14.2 Conses Dictionary"
|
|
><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"
|
|
>→ <A HREF="14_Conses.html"
|
|
>14. Conses</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="14_2_Conses_Dictionary.html"
|
|
>14.2 Conses Dictionary</A
|
|
></SPAN
|
|
> <SPAN CLASS="breadcrumb-item"
|
|
>→ <A HREF="f_nthcdr.html"
|
|
>nthcdr</A
|
|
></SPAN
|
|
></DIV
|
|
><DIV CLASS="apropos"
|
|
><DIV CLASS="apropos-io"
|
|
><A HREF="f_ldiff.html" CLASS="prev"
|
|
>←</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="f_rest.html" CLASS="next"
|
|
>→</A
|
|
></DIV
|
|
><DIV ID="apropos-res"
|
|
></DIV
|
|
></DIV
|
|
></DIV
|
|
><DIV CLASS="matter"
|
|
><DIV CLASS="com"
|
|
><DIV CLASS="begincom"
|
|
><HR
|
|
><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"
|
|
><TR
|
|
><TD ALIGN="LEFT" VALIGN="BASELINE" WIDTH="100%" CLASS="name"
|
|
><SPAN CLASS="idx" DATA-KIND="idxref" DATA-TERM="nthcdr"
|
|
></SPAN
|
|
><B
|
|
>nthcdr</B
|
|
></TD
|
|
><TD ALIGN="RIGHT" VALIGN="BASELINE" WIDTH="0" NOWRAP="NOWRAP" CLASS="ftype"
|
|
><I
|
|
>Function</I
|
|
></TD
|
|
></TR
|
|
></TABLE
|
|
><HR
|
|
></DIV
|
|
><UL CLASS="subtoc"
|
|
></UL
|
|
><DL
|
|
><DT
|
|
><B
|
|
>Syntax</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
><B
|
|
>nthcdr</B
|
|
> <SPAN CLASS="cmssi"
|
|
>n</SPAN
|
|
> <SPAN CLASS="cmssi"
|
|
>list</SPAN
|
|
> <SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
> <SPAN CLASS="cmssi"
|
|
>tail</SPAN
|
|
></P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Arguments and Values</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
><VAR CLASS="param"
|
|
>n</VAR
|
|
> — a non-negative <A HREF="26_1_Glossary.html#integer"
|
|
><EM CLASS="term"
|
|
>integer</EM
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
><VAR CLASS="param"
|
|
>list</VAR
|
|
> — a <A HREF="26_1_Glossary.html#list"
|
|
><EM CLASS="term"
|
|
>list</EM
|
|
></A
|
|
>, which might be a <A HREF="26_1_Glossary.html#dotted_list"
|
|
><EM CLASS="term"
|
|
>dotted list</EM
|
|
></A
|
|
> or a <A HREF="26_1_Glossary.html#circular_list"
|
|
><EM CLASS="term"
|
|
>circular list</EM
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
><VAR CLASS="param"
|
|
>tail</VAR
|
|
> — an <A HREF="26_1_Glossary.html#object"
|
|
><EM CLASS="term"
|
|
>object</EM
|
|
></A
|
|
>.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Description</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>Returns the <A HREF="26_1_Glossary.html#tail"
|
|
><EM CLASS="term"
|
|
>tail</EM
|
|
></A
|
|
> of <VAR CLASS="param"
|
|
>list</VAR
|
|
> that would be obtained by calling <A HREF="f_car.html" CLASS="funref"
|
|
><B
|
|
>cdr</B
|
|
></A
|
|
> <VAR CLASS="param"
|
|
>n</VAR
|
|
> times in succession.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Examples</B
|
|
></DT
|
|
><DD
|
|
><PRE CLASS="screen"
|
|
>(nthcdr 0 '()) <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> NIL
|
|
(nthcdr 3 '()) <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> NIL
|
|
(nthcdr 0 '(a b c)) <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> (A B C)
|
|
(nthcdr 2 '(a b c)) <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> (C)
|
|
(nthcdr 4 '(a b c)) <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> ()
|
|
(nthcdr 1 '(0 . 1)) <SPAN CLASS="cmsy"
|
|
><SPAN CLASS="arrow"
|
|
>→</SPAN
|
|
></SPAN
|
|
> 1
|
|
|
|
(locally (declare (optimize (safety 3)))
|
|
(nthcdr 3 '(0 . 1)))
|
|
Error: Attempted to take CDR of 1.</PRE
|
|
></DD
|
|
><DT
|
|
><B
|
|
>Exceptional Situations</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
>Should signal an error of <A HREF="26_1_Glossary.html#type"
|
|
><EM CLASS="term"
|
|
>type</EM
|
|
></A
|
|
> <A HREF="t_type-error.html" CLASS="typeref"
|
|
><B
|
|
>type-error</B
|
|
></A
|
|
> if <VAR CLASS="param"
|
|
>n</VAR
|
|
> is not a non-negative <A HREF="26_1_Glossary.html#integer"
|
|
><EM CLASS="term"
|
|
>integer</EM
|
|
></A
|
|
>. </P
|
|
><P CLASS="j"
|
|
>For <VAR CLASS="param"
|
|
>n</VAR
|
|
> being an integer greater than <CODE CLASS="f"
|
|
>1</CODE
|
|
>, the error checking done by <CODE CLASS="f"
|
|
>(nthcdr <VAR CLASS="param"
|
|
>n</VAR
|
|
> <VAR CLASS="param"
|
|
>list</VAR
|
|
>)</CODE
|
|
> is the same as for <CODE CLASS="f"
|
|
>(nthcdr (- <VAR CLASS="param"
|
|
>n</VAR
|
|
> 1) (cdr <VAR CLASS="param"
|
|
>list</VAR
|
|
>))</CODE
|
|
>; see the <A HREF="26_1_Glossary.html#function"
|
|
><EM CLASS="term"
|
|
>function</EM
|
|
></A
|
|
> <A HREF="f_car.html" CLASS="funref"
|
|
><B
|
|
>cdr</B
|
|
></A
|
|
>.</P
|
|
></DD
|
|
><DT
|
|
><B
|
|
>See Also</B
|
|
></DT
|
|
><DD
|
|
><P CLASS="j"
|
|
><A HREF="f_car.html" CLASS="funref"
|
|
><B
|
|
>cdr</B
|
|
></A
|
|
>, <A HREF="f_nth.html" CLASS="funref"
|
|
><B
|
|
>nth</B
|
|
></A
|
|
>, <A HREF="f_rest.html" CLASS="funref"
|
|
><B
|
|
>rest</B
|
|
></A
|
|
></P
|
|
></DD
|
|
></DL
|
|
></DIV
|
|
></DIV
|
|
><DIV CLASS="footer"
|
|
><DIV CLASS="btmnav"
|
|
><A HREF="f_ldiff.html" CLASS="prev"
|
|
>←</A
|
|
><A HREF="f_rest.html" CLASS="next"
|
|
>→</A
|
|
></DIV
|
|
><DIV CLASS="trail"
|
|
>Conversion to HTML copyright 2023 by Gilbert Baumann</DIV
|
|
></DIV
|
|
></DIV
|
|
><SCRIPT
|
|
>domReady();</SCRIPT
|
|
></BODY
|
|
></HTML
|
|
> |