comparison lispref/sequences.texi @ 52787:785941182067

Char-tables are sequences. Add string-bytes.
author Dave Love <fx@gnu.org>
date Mon, 06 Oct 2003 16:52:24 +0000
parents 695cf19ef79e
children e05aaf8021c8
comparison
equal deleted inserted replaced
52786:69d6dc55b638 52787:785941182067
67 common property of all sequences is that they are ordered collections of 67 common property of all sequences is that they are ordered collections of
68 elements. This section describes functions that accept any kind of 68 elements. This section describes functions that accept any kind of
69 sequence. 69 sequence.
70 70
71 @defun sequencep object 71 @defun sequencep object
72 Returns @code{t} if @var{object} is a list, vector, or 72 Returns @code{t} if @var{object} is a list, vector,
73 string, @code{nil} otherwise. 73 string, or char-table, @code{nil} otherwise.
74 @end defun 74 @end defun
75 75
76 @defun length sequence 76 @defun length sequence
77 @cindex string length 77 @cindex string length
78 @cindex list length 78 @cindex list length
79 @cindex vector length 79 @cindex vector length
80 @cindex sequence length 80 @cindex sequence length
81 @cindex char-table length
81 This function returns the number of elements in @var{sequence}. If 82 This function returns the number of elements in @var{sequence}. If
82 @var{sequence} is a cons cell that is not a list (because the final 83 @var{sequence} is a cons cell that is not a list (because the final
83 @sc{cdr} is not @code{nil}), a @code{wrong-type-argument} error is 84 @sc{cdr} is not @code{nil}), a @code{wrong-type-argument} error is
84 signaled. 85 signaled. For a char-table, the value returned is always one more
86 than the maximum Emacs character code.
85 87
86 @xref{List Elements}, for the related function @code{safe-length}. 88 @xref{List Elements}, for the related function @code{safe-length}.
87 89
88 @example 90 @example
89 @group 91 @group
105 @group 107 @group
106 (length (make-bool-vector 5 nil)) 108 (length (make-bool-vector 5 nil))
107 @result{} 5 109 @result{} 5
108 @end group 110 @end group
109 @end example 111 @end example
112 @end defun
113
114 @defun string-bytes string
115 @cindex string, number of bytes
116 This function returns the number of bytes in @var{string}.
117 If @var{string} is a multibyte string, this is greater than
118 @code{(length @var{string})}.
110 @end defun 119 @end defun
111 120
112 @defun elt sequence index 121 @defun elt sequence index
113 @cindex elements of sequences 122 @cindex elements of sequences
114 This function returns the element of @var{sequence} indexed by 123 This function returns the element of @var{sequence} indexed by