(doc-group array «Arrays and vectors.») (defdoc (copy-vec vec) «Return a copy of the vector with the same elements. No copies of the values themselves are created, the original values are reused.» :doc-example «(def v #vec(1 2 "three")) (def q (copy-vec v)) (eq? v q) ; ↳ NIL (equal? v q) ; ↳ T (map eq? v q) ; ↳ #(T T T)» :doc-group array) (defdoc (vec-alloc length . rest) «Construct a vector of the specified `length` by repeating the elements in `rest`.» :doc-example «(vec-alloc 5 2.5) ; ↳ #(2.5 2.5 2.5 2.5 2.5)» :doc-example «(vec-alloc 10 1 2.5 "a" 'b) ; ↳ #(1 2.5 "a" b 1 2.5 "a" b 1 2.5)» :doc-group array :doc-see vec :doc-see arr-alloc) (defdoc (arr type . rest) «Construct a packed array containing the specified arguments. The arguments will be coerced to a single `type` which must be a fixed-width number or pointer type, or rune.» :doc-example «(arr 's8 0 1 2) ; ↳ #arr(s8 0 1 2)» :doc-example «(arr 'rune 0 1 2) ; ↳ #arr(rune #\nul #\soh #\stx)» :doc-group array :doc-see arr-alloc :doc-see vec) (defdoc (arr-alloc type length . rest) «Construct a packed array of the specified `length` by repeating the elements in `rest`. The arguments will be coerced to a single `type` which must be a fixed-width number or pointer type, or rune.» :doc-example «(arr-alloc 'u16 5 -1) ; ↳ #arr(u16 65535 65535 65535 65535 65535)» :doc-example «(arr-alloc 's8 10 0 1 2) ; ↳ #arr(s8 0 1 2 0 1 2 0 1 2 0)» :doc-group array :doc-see arr :doc-see vec-alloc)