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.

cons

cons

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

SYNTAX

(cons <expr-car> <expr-cdr> )
        <arg>           -       description
        <expr-car>      -       an expression 
        <expr-cdr>      -       an expression

DESCRIPTION

The CONS function takes two expressions and constructs a new list from them. If the <expr-cdr> is not a list, then the result will be a 'dotted-pair'.

EXAMPLES

(cons 'a 'b)                            ; returns (A . B)
(cons 'a nil)                           ; returns (A)
(cons 'a '(b))                          ; returns (A B)
(cons '(a b) '(c d))                    ; returns ((A B) C D)
(cons '(a b) 'c)                        ; returns ((A B) . C)
(cons (- 4 3) '(2 3))                   ; returns (1 2 3)


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