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

6.4.5 Other list procedures

Function: append list ...
[R5RS] Returns a list consisting of the elements of the first list followed by the elements of the other lists. The resulting list is always newly allocated, except that it shares structure with the last list argument. The last argument may actually be any object; an improper list results if the last argument is not a proper list.

Function: append! list ...
[SRFI-1] Returns a list consisting of the elements of the first list followed by the elements of the other lists. The cells in the lists except the last one may be reused to construct the result. The last argument may be any object.

Function: reverse list
[R5RS] Returns a newly allocated list consisting of the elements of list in reverse order.

Function: reverse! list
[SRFI-1] Returns a list consisting of the elements of list in reverse order. The cells of list may be reused to construct the returned list.

Function: memq obj list
Function: memv obj list
Function: member obj list
[R5RS] Searches obj in the list. If n-th element of list equals to obj (in the sense of eq? for memq, eqv? for memv, and equal? for member), (list-tail list n) is returned. Otherwise, #f is returned.

If you use SRFI-1 (See section 10.2 srfi-1 - List library), member is extended to take optional argument for a equality procedure.
 
(memq 'a '(a b c))          => (a b c)
(memq 'b '(a b c))          =>  (b c)
(memq 'a '(b c d))          => #f
(memq (list 'a) '(b (a) c)) => #f
(memv 101 '(100 101 102))   => (101 102)

Function: assq obj list
Function: assv obj list
Function: assoc obj list
[R5RS] Each element in list must be a pair. These procedures search a pair whose car matches obj (in the sense of eq? for assq, eqv? for assv, and equal? for assoc) from left to right, and return the leftmost matched pair if any. If no pair matches, these return #f.

If you use SRFI-1 (See section 10.2 srfi-1 - List library), assoc is extended to take optional argument for a equality procedure.


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

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