So, I'm trying to learn Lisp, and I ran into a problem in determining what String is.
I read ANSI Common Lisp by Paul Graham, and this book says that String is a vector or a one-dimensional array.
So, I am creating a line:
(defvar *my-string* "abc")
And then I can access the first value of my string as follows:
(aref *my-string* 0)
But if it's a vector, why can't I access this element this way:
(svref *my-string* 0)
I mean, when I create a vector this way:
(defvar my-vec (make-array 4 :initial-element 1))
I can access the first item using svref:
(svref my-vec 0) ; returns 1
I forgot to add an error when I try svref on a String:
"The value" abc "is not of type (SIMPLE-ARRAY T (*))."
source share