comparison lispref/lists.texi @ 54945:70fd47f8342a

Add anchors. Some other minor changes.
author Luc Teirlinck <teirllm@auburn.edu>
date Sat, 17 Apr 2004 00:52:46 +0000
parents 9fd3a94524eb
children 1874eee23678
comparison
equal deleted inserted replaced
54944:205e2027ce65 54945:70fd47f8342a
325 x 325 x
326 @result{} (b c) 326 @result{} (b c)
327 @end example 327 @end example
328 @end defmac 328 @end defmac
329 329
330 @anchor{Definition of nth}
330 @defun nth n list 331 @defun nth n list
331 This function returns the @var{n}th element of @var{list}. Elements 332 This function returns the @var{n}th element of @var{list}. Elements
332 are numbered starting with zero, so the @sc{car} of @var{list} is 333 are numbered starting with zero, so the @sc{car} of @var{list} is
333 element number zero. If the length of @var{list} is @var{n} or less, 334 element number zero. If the length of @var{list} is @var{n} or less,
334 the value is @code{nil}. 335 the value is @code{nil}.
389 @code{nil} is returned. If @var{n} is non-@code{nil}, the 390 @code{nil} is returned. If @var{n} is non-@code{nil}, the
390 @var{n}th-to-last link is returned instead, or the whole of @var{list} 391 @var{n}th-to-last link is returned instead, or the whole of @var{list}
391 if @var{n} is bigger than @var{list}'s length. 392 if @var{n} is bigger than @var{list}'s length.
392 @end defun 393 @end defun
393 394
395 @anchor{Definition of safe-length}
394 @defun safe-length list 396 @defun safe-length list
395 This function returns the length of @var{list}, with no risk 397 This function returns the length of @var{list}, with no risk
396 of either an error or an infinite loop. 398 of either an error or an infinite loop.
397 399
398 If @var{list} is not really a list, @code{safe-length} returns 0. If 400 If @var{list} is not really a list, @code{safe-length} returns 0. If
563 More generally, the final argument to @code{append} may be any Lisp 565 More generally, the final argument to @code{append} may be any Lisp
564 object. The final argument is not copied or converted; it becomes the 566 object. The final argument is not copied or converted; it becomes the
565 @sc{cdr} of the last cons cell in the new list. If the final argument 567 @sc{cdr} of the last cons cell in the new list. If the final argument
566 is itself a list, then its elements become in effect elements of the 568 is itself a list, then its elements become in effect elements of the
567 result list. If the final element is not a list, the result is a 569 result list. If the final element is not a list, the result is a
568 ``dotted list'' since its final @sc{cdr} is not @code{nil} as required 570 dotted list since its final @sc{cdr} is not @code{nil} as required
569 in a true list. 571 in a true list.
570 572
571 In Emacs 20 and before, the @code{append} function also allowed 573 In Emacs 20 and before, the @code{append} function also allowed
572 integers as (non last) arguments. It converted them to strings of 574 integers as (non last) arguments. It converted them to strings of
573 digits, making up the decimal print representation of the integer, and 575 digits, making up the decimal print representation of the integer, and
706 @end group 708 @end group
707 @end example 709 @end example
708 @end defun 710 @end defun
709 711
710 @defun copy-tree tree &optional vecp 712 @defun copy-tree tree &optional vecp
711 This function returns a copy the tree @code{tree}. If @var{tree} is a 713 This function returns a copy of the tree @code{tree}. If @var{tree} is a
712 cons cell, this makes a new cons cell with the same @sc{car} and 714 cons cell, this makes a new cons cell with the same @sc{car} and
713 @sc{cdr}, then recursively copies the @sc{car} and @sc{cdr} in the 715 @sc{cdr}, then recursively copies the @sc{car} and @sc{cdr} in the
714 same way. 716 same way.
715 717
716 Normally, when @var{tree} is anything other than a cons cell, 718 Normally, when @var{tree} is anything other than a cons cell,
730 732
731 All arguments can be integers or floating point numbers. However, 733 All arguments can be integers or floating point numbers. However,
732 floating point arguments can be tricky, because floating point 734 floating point arguments can be tricky, because floating point
733 arithmetic is inexact. For instance, depending on the machine, it may 735 arithmetic is inexact. For instance, depending on the machine, it may
734 quite well happen that @code{(number-sequence 0.4 0.6 0.2)} returns 736 quite well happen that @code{(number-sequence 0.4 0.6 0.2)} returns
735 the one element list @code{(0.4)}, whereas 737 the one element list @code{(0.4)}, whereas
736 @code{(number-sequence 0.4 0.8 0.2)} returns a list with three 738 @code{(number-sequence 0.4 0.8 0.2)} returns a list with three
737 elements. The @var{n}th element of the list is computed by the exact 739 elements. The @var{n}th element of the list is computed by the exact
738 formula @code{(+ @var{from} (* @var{n} @var{separation}))}. Thus, if 740 formula @code{(+ @var{from} (* @var{n} @var{separation}))}. Thus, if
739 one wants to make sure that @var{to} is included in the list, one can 741 one wants to make sure that @var{to} is included in the list, one can
740 pass an expression of this exact type for @var{to}. Alternatively, 742 pass an expression of this exact type for @var{to}. Alternatively,