changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/std/array.lisp

changeset 692: f51b73f49946
parent: 00d1c8afcdbb
author: Richard Westhaver <ellis@rwest.io>
date: Thu, 03 Oct 2024 17:56:11 -0400
permissions: -rw-r--r--
description: std/task and tests
1 ;;; std/array.lisp --- Standard Arrays
2 
3 ;;
4 
5 ;;; Code:
6 ;; sb-kernel:with-array-data
7 (in-package :std/array)
8 
9 (defun copy-array (array)
10  (let ((new-array
11  (make-array (array-dimensions array)
12  :element-type (array-element-type array)
13  :adjustable (adjustable-array-p array)
14  :fill-pointer (and (array-has-fill-pointer-p array)
15  (fill-pointer array)))))
16  (loop for i below (array-total-size array)
17  do (setf (row-major-aref new-array i)
18  (row-major-aref array i)))
19  new-array))
20 
21 (deftype signed-array-length ()
22  "A (possibly negated) array length."
23  '#.(let ((limit (1- array-dimension-limit)))
24  `(integer ,(- limit) ,limit)))