The array-utils Reference Manual

This is the array-utils Reference Manual, version 1.3.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 08 16:22:17 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 array-utils

A few utilities for working with arrays.

Maintainer

Yukari Hafner <>

Author

Yukari Hafner <>

Home Page

https://Shinmera.github.io/array-utils/

Source Control

(GIT https://github.com/Shinmera/array-utils.git)

Bug Tracker

https://github.com/Shinmera/array-utils/issues

License

zlib

Version

1.3.0

Source

array-utils.asd.

Child Component

utils.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 array-utils/array-utils.asd

Source

array-utils.asd.

Parent Component

array-utils (system).

ASDF Systems

array-utils.


3.1.2 array-utils/utils.lisp

Source

array-utils.asd.

Parent Component

array-utils (system).

Packages

array-utils.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 array-utils

Source

utils.lisp.

Nickname

org.shirakumo.array-utils

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Ordinary functions

Function: array-shift (array &key n from to adjust fill contents)

Shifts a subset of array elements in either direction for a specified amount.
Optionally also extends the array and fills empty space with a given element.

N — The amount to be moved. If positive, things are shifted to the right. If negative, things are shifted to the left.
FROM — The left point of the region to move, inclusive.
TO — The right point of the region to move, exclusive.
ADJUST — Whether to adjust the fill pointer and the array bounds. The array is only adjusted if N is positive and the range of TO+N would exceed the ARRAY length, or if N is negative and TO equals the length of the ARRAY
FILL — If provided, empty spaces created by the move will be filled with this element. CONTENTS — If provided, uses the contents to fill the new space. If |N| is greater than the length of this sequence, FILL is used to fill the rest of the space if it is provided. If not, an error is signalled. No matter whether N is negative or positive, the content is filled in from left to right in the order it is given.

Package

array-utils.

Source

utils.lisp.

Function: ensure-array-size (array new-space)
Package

array-utils.

Source

utils.lisp.

Function: nslice (vector &optional start end step)

Modifies the vector to a sub-vector of itself.

START — If positive:
the inclusive starting index of the slice If negative:
the inclusive starting index of the slice from the end of the vector
If NULL: same as zero
END — If positive:
the exclusive ending index of the slice
If negative:
the exclusive ending index of the slice from the end of the vector.
If NULL: same as the length of the vector STEP — If above zero:
the step size between elements of the slice If NULL: same as one

Note that this always modifies the passed vector, and adjusts the fill pointer, if one is present.

See NSLICE
See SLICE*

Package

array-utils.

Source

utils.lisp.

Function: slice (vector &optional start end step)

Creates a sub-vector of the given vector.

START — If positive:
the inclusive starting index of the slice If negative:
the inclusive starting index of the slice from the end of the vector
If NULL: same as zero
END — If positive:
the exclusive ending index of the slice
If negative:
the exclusive ending index of the slice from the end of the vector.
If NULL: same as the length of the vector STEP — If above zero:
the step size between elements of the slice If NULL: same as one

Note that this always creates a fresh copy of the vector, preserving the element type and other properties.

See NSLICE
See SLICE*

Package

array-utils.

Source

utils.lisp.

Function: slice* (vector &optional start end)

Creates a sub-vector of the given vector.

START — If positive:
the inclusive starting index of the slice If negative:
the inclusive starting index of the slice from the end of the vector
If NULL: same as zero
END — If positive:
the exclusive ending index of the slice
If negative:
the exclusive ending index of the slice from the end of the vector.
If NULL: same as the length of the vector

Note that this creates a displaced vector pointing to the original vector. It thus shares the data with the original vector, and does not support a STEP size other than 1.

See SLICE
See NSLICE

Package

array-utils.

Source

utils.lisp.

Function: vector-append (vector sequence &optional position)

Appends all elements of the sequence at position of the vector and returns it. This is potentially very costly as all elements after the given position need to be shifted back as per ARRAY-SHIFT.

Package

array-utils.

Source

utils.lisp.

Function: vector-pop-element (vector element)

Pops the element from the vector and returns it if it was contained. This is potentially very costly as all elements after the given position need to be shifted back as per ARRAY-SHIFT.

If the array has an element-type of T, the element moved beyond the fill pointer is set to NIL to avoid a memory leak.

See VECTOR-POP-POSITION
See VECTOR-POP-ELEMENT*

Package

array-utils.

Source

utils.lisp.

Function: vector-pop-element* (vector element)

Pops the element from the vector and returns it if it was contained.
This is faster than VECTOR-POP-ELEMENT, but does not preserve the order of elements in the vector.

If the array has an element-type of T, the element moved beyond the fill pointer is set to NIL to avoid a memory leak.

See VECTOR-POP-POSITION*
See VECTOR-POP-ELEMENT

Package

array-utils.

Source

utils.lisp.

Function: vector-pop-front (vector)

Pops the first element off the vector and returns it.
This operation is very costly and takes O(n) time as each element needs to be shifted as per ARRAY-SHIFT.

See VECTOR-POP-FRONT*
See VECTOR-POP-POSITION

Package

array-utils.

Source

utils.lisp.

Function: vector-pop-front* (vector)

Pops the first element off the vector and returns it.
This is faster than VECTOR-POP-FRONT, but does not preserve the order of elements in the vector.

See VECTOR-POP-FRONT
See VECTOR-POP-POSITION

Package

array-utils.

Source

utils.lisp.

Function: vector-pop-position (vector position)

Pops the element at the given position of the vector and returns it. This is potentially very costly as all elements after the given position need to be shifted back as per ARRAY-SHIFT.

If the array has an element-type of T, the element moved beyond the fill pointer is set to NIL to avoid a memory leak.

See VECTOR-POP-POSITION*

Package

array-utils.

Source

utils.lisp.

Function: vector-pop-position* (vector position)

Pops the element at the given position of the vector and returns it.
This is faster than VECTOR-POP-POSITION, but does not preserve the order of elements in the vector.

If the array has an element-type of T, the element moved beyond the fill
pointer is set to NIL to avoid a memory leak.

See VECTOR-POP-POSITION

Package

array-utils.

Source

utils.lisp.

Function: vector-push-extend-front (element vector)

Pushes the element onto the front of the vector and extends if necessary. This operation is very costly and takes O(n) time as each element needs to be shifted as per ARRAY-SHIFT.

See VECTOR-PUSH-EXTEND-POSITION

Package

array-utils.

Source

utils.lisp.

Function: vector-push-extend-new (element vector &key key test test-not)

Pushes the element onto the back of the vector and extends if necessary, if it is not already part of the vector.

If TEST is passed, it is used to compare the elements. Defaults to EQL
If TEST-NOT is passed, its complement is used to compare the element.
If KEY is passed, it is used to extract the element comparison key for
both ELEMENT and each element in VECTOR.

Returns the existing element in VECTOR or the new ELEMENT if it was
inserted at the end.

See CL:VECTOR-PUSH-EXTEND

Package

array-utils.

Source

utils.lisp.

Function: vector-push-extend-position (element vector position)

Pushes the element into the specified position and shifts everything to the right to make space. This is potentially very costly as all elements after the given position need to be shifted as per ARRAY-SHIFT.

Package

array-utils.

Source

utils.lisp.


5.2 Internals


5.2.1 Macros

Macro: do-vector-types (value &body body)
Package

array-utils.

Source

utils.lisp.


5.2.2 Types

Type: positive-fixnum ()
Package

array-utils.

Source

utils.lisp.


Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   A   D   E   F   M   N   S   V  
Index Entry  Section

A
array-shift: Public ordinary functions

D
do-vector-types: Private macros

E
ensure-array-size: Public ordinary functions

F
Function, array-shift: Public ordinary functions
Function, ensure-array-size: Public ordinary functions
Function, nslice: Public ordinary functions
Function, slice: Public ordinary functions
Function, slice*: Public ordinary functions
Function, vector-append: Public ordinary functions
Function, vector-pop-element: Public ordinary functions
Function, vector-pop-element*: Public ordinary functions
Function, vector-pop-front: Public ordinary functions
Function, vector-pop-front*: Public ordinary functions
Function, vector-pop-position: Public ordinary functions
Function, vector-pop-position*: Public ordinary functions
Function, vector-push-extend-front: Public ordinary functions
Function, vector-push-extend-new: Public ordinary functions
Function, vector-push-extend-position: Public ordinary functions

M
Macro, do-vector-types: Private macros

N
nslice: Public ordinary functions

S
slice: Public ordinary functions
slice*: Public ordinary functions

V
vector-append: Public ordinary functions
vector-pop-element: Public ordinary functions
vector-pop-element*: Public ordinary functions
vector-pop-front: Public ordinary functions
vector-pop-front*: Public ordinary functions
vector-pop-position: Public ordinary functions
vector-pop-position*: Public ordinary functions
vector-push-extend-front: Public ordinary functions
vector-push-extend-new: Public ordinary functions
vector-push-extend-position: Public ordinary functions


A.3 Variables