Structural Informatics Group (SIG) logo
Home | Projects | Demos | Downloads | Publications | Local Info | About Us | New site
Go to the first, previous, next, last section, table of contents.

nth

nth

type: function (subr) 
location: built-in
source file: xllist.c
Common LISP compatible: yes
supported on: all machines

SYNTAX

(nth <expr> <list-expr> )
        <expr>          -       an integer expression
        <list-expr>     -       a list or list expression

DESCRIPTION

NTH returns the <expr>'th element of <list-expr>. If the <list-expr> is shorter than <expr>, a NIL is returned. The counting sequence is base zero - the first element is the 0th element.

EXAMPLES

(nth 4 '(0 1 2 3 4 5 6))                ; returns 4
(nth 3 '(a b))                          ; returns NIL
                                        ;
(nth 4 'a)                              ; error: bad argument type 
(nth 3 "abcdefg")                       ; error: bad argument type 


Go to the first, previous, next, last section, table of contents.