[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

6.4.3 List constructors

Function: cons obj1 obj2
[R5RS] Constructs a pair of obj1 and obj2 and returns it.
 
(cons 'a 'b) => (a . b)

Function: acons obj1 obj2 obj3
Returns (cons (cons obj1 obj2) obj3). Useful to put an entry at the head of an associative list.
 
(acons 'a 'b '((c . d))) => ((a . b) (c . d))

Function: make-list len &optional fill
[SRFI-1] Makes a proper list of length len. If optional argument fill is provided, each element is initialized by it. Otherwise each element is undefined.
 
(make-list 5 #t) => (#t #t #t #t #t)

Function: list obj ...
[R5RS] Makes a list, whose elements are obj ....
 
(list 1 2 3) => (1 2 3)
(list) => ()

Function: list* obj1 obj2 ...
Like list, but the last argument becomes cdr of the last pair. SRFI-1 defines the same function with the name cons*.
 
(list* 1 2 3) => (1 2 . 3)
(list* 1) => 1

Function: list-copy list
[SRFI-1] Shallow copies list. If list is circular, this function diverges.



This document was generated by Ken Dickey on November, 28 2002 using texi2html