How to manipulate vectors in Emacs Lisp?
September 07, 2023
(vector (+ 1 1) nil "foo") ;; [2 nil "foo"]
[(+ 1 1) nil "foo"] ;; [(+ 1 1) nil "foo"]
(setq vec1 [a b c]) ;; [a b c]
(aref vec1 0) ;; a
(aset vec1 0 'foo) ;; foo
vec1 ;; [foo b c]
(setq vec2 (seq-copy vec1)) ;; [foo b c]
(aset vec2 0 'bar) ;; bar
vec2 ;; [bar b c]
vec1 ;; [foo b c]