1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 03:40:34 +02:00

Doc: mention vectors are self-quoting

Reported by Dmitry Bogatov <KAction@gnu.org>.

* doc/ref/api-compound.texi (Vector Syntax, Vector Creation): Mention
  that vectors are self-quoting. Remove examples with quote signs.
This commit is contained in:
Ian Price 2013-10-09 22:48:16 +01:00
parent 84a410dbd2
commit ddda4d53e5

View file

@ -689,22 +689,18 @@ Vectors can literally be entered in source code, just like strings,
characters or some of the other data types. The read syntax for vectors characters or some of the other data types. The read syntax for vectors
is as follows: A sharp sign (@code{#}), followed by an opening is as follows: A sharp sign (@code{#}), followed by an opening
parentheses, all elements of the vector in their respective read syntax, parentheses, all elements of the vector in their respective read syntax,
and finally a closing parentheses. The following are examples of the and finally a closing parentheses. Like strings, vectors do not have to
read syntax for vectors; where the first vector only contains numbers be quoted.
and the second three different object types: a string, a symbol and a
number in hexadecimal notation. The following are examples of the read syntax for vectors; where the
first vector only contains numbers and the second three different object
types: a string, a symbol and a number in hexadecimal notation.
@lisp @lisp
#(1 2 3) #(1 2 3)
#("Hello" foo #xdeadbeef) #("Hello" foo #xdeadbeef)
@end lisp @end lisp
Like lists, vectors have to be quoted:
@lisp
'#(a b c) @result{} #(a b c)
@end lisp
@node Vector Creation @node Vector Creation
@subsubsection Dynamic Vector Creation and Validation @subsubsection Dynamic Vector Creation and Validation
@ -735,7 +731,7 @@ The inverse operation is @code{vector->list}:
Return a newly allocated list composed of the elements of @var{v}. Return a newly allocated list composed of the elements of @var{v}.
@lisp @lisp
(vector->list '#(dah dah didah)) @result{} (dah dah didah) (vector->list #(dah dah didah)) @result{} (dah dah didah)
(list->vector '(dididit dah)) @result{} #(dididit dah) (list->vector '(dididit dah)) @result{} #(dididit dah)
@end lisp @end lisp
@end deffn @end deffn
@ -796,8 +792,8 @@ Return the number of elements in @var{vec} as a @code{size_t}.
Return the contents of position @var{k} of @var{vec}. Return the contents of position @var{k} of @var{vec}.
@var{k} must be a valid index of @var{vec}. @var{k} must be a valid index of @var{vec}.
@lisp @lisp
(vector-ref '#(1 1 2 3 5 8 13 21) 5) @result{} 8 (vector-ref #(1 1 2 3 5 8 13 21) 5) @result{} 8
(vector-ref '#(1 1 2 3 5 8 13 21) (vector-ref #(1 1 2 3 5 8 13 21)
(let ((i (round (* 2 (acos -1))))) (let ((i (round (* 2 (acos -1)))))
(if (inexact? i) (if (inexact? i)
(inexact->exact i) (inexact->exact i)