340 |
variants. |
variants. |
341 |
|
|
342 |
@rnindex append |
@rnindex append |
343 |
@deffn {Scheme Procedure} append . args |
@deffn {Scheme Procedure} append lst1 @dots{} lstN |
344 |
@deffnx {C Function} scm_append (args) |
@deffnx {Scheme Procedure} append! lst1 @dots{} lstN |
345 |
Return a list consisting of the elements the lists passed as |
@deffnx {C Function} scm_append (lstlst) |
346 |
arguments. |
@deffnx {C Function} scm_append_x (lstlst) |
347 |
|
Return a list comprising all the elements of lists @var{lst1} to |
348 |
|
@var{lstN}. |
349 |
|
|
350 |
@lisp |
@lisp |
351 |
(append '(x) '(y)) @result{} (x y) |
(append '(x) '(y)) @result{} (x y) |
352 |
(append '(a) '(b c d)) @result{} (a b c d) |
(append '(a) '(b c d)) @result{} (a b c d) |
353 |
(append '(a (b)) '((c))) @result{} (a (b) (c)) |
(append '(a (b)) '((c))) @result{} (a (b) (c)) |
354 |
@end lisp |
@end lisp |
355 |
The resulting list is always newly allocated, except that it |
|
356 |
shares structure with the last list argument. The last |
The last argument @var{lstN} may actually be any object; an improper |
357 |
argument may actually be any object; an improper list results |
list results if the last argument is not a proper list. |
358 |
if the last argument is not a proper list. |
|
359 |
@lisp |
@lisp |
360 |
(append '(a b) '(c . d)) @result{} (a b c . d) |
(append '(a b) '(c . d)) @result{} (a b c . d) |
361 |
(append '() 'a) @result{} a |
(append '() 'a) @result{} a |
362 |
@end lisp |
@end lisp |
|
@end deffn |
|
363 |
|
|
364 |
@deffn {Scheme Procedure} append! . lists |
@code{append} doesn't modify the given lists, but the return may share |
365 |
@deffnx {C Function} scm_append_x (lists) |
structure with the final @var{lstN}. @code{append!} modifies the |
366 |
A destructive version of @code{append} (@pxref{Pairs and |
given lists to form its return. |
367 |
lists,,,r5rs, The Revised^5 Report on Scheme}). The cdr field |
|
368 |
of each list's final pair is changed to point to the head of |
For @code{scm_append} and @code{scm_append_x}, @var{lstlst} is a list |
369 |
the next list, so no consing is performed. Return a pointer to |
of the list operands @var{lst1} @dots{} @var{lstN}. That @var{lstlst} |
370 |
the mutated list. |
itself is not modified or used in the return. |
371 |
@end deffn |
@end deffn |
372 |
|
|
373 |
@rnindex reverse |
@rnindex reverse |