base-string
base-string Type
Supertypes:
base-string, string, vector, array, sequence, t
Description:
The type base-string is equivalent to (vector base-char). The base string representation is the most efficient string representation that can hold an arbitrary sequence of standard characters.
Compound Type Specifier Kind:
Abbreviating.
Compound Type Specifier Syntax:
(base-string [size])
Compound Type Specifier Arguments:
size—a non-negative fixnum, or the symbol *.
Compound Type Specifier Description:
This is equivalent to the type (vector base-char size); that is, the set of base strings of size size.
Expanded Reference: base-string
base-string is equivalent to (vector base-char)
A base-string is a string whose elements are of type base-char. It is the most efficient string representation for standard characters.
;; In SBCL, string literals have element-type CHARACTER, not BASE-CHAR
(typep "hello" 'base-string)
=> NIL
(subtypep 'base-string 'string)
=> T
=> T
Type checking with the compound type specifier
The compound form (base-string size) specifies a base-string of a particular length.
;; In SBCL, string literals are not base-strings
(typep "abc" '(base-string 3))
=> NIL
(typep "abc" '(base-string 5))
=> NIL
(typep "abc" '(base-string *))
=> NIL
Relationship to other string types
base-string is a subtype of string and a supertype of simple-base-string.
(subtypep 'base-string 'string)
=> T
=> T
(subtypep 'simple-base-string 'base-string)
=> T
=> T
(subtypep 'base-string 'vector)
=> T
=> T
Creating base-strings with make-string
make-string with :element-type 'base-char creates a simple base-string.
(let ((s (make-string 4 :initial-element #\Z :element-type 'base-char)))
(list s (typep s 'base-string)))
=> ("ZZZZ" T)