## About Array-Utils

A miniature toolkit that contains some useful shifting/popping/pushing functions for arrays and vectors. This exists mostly because I've used these functions in multiple places already, so splitting it off into its own thing is a good idea. Originally from Plump.

## Copyright

array-utils is licensed under the Artistic license. © Nicolas Hafner <shinmera@tymoon.eu> . This library can be obtained on https://github.com/Shinmera/array-utils.

## Package Index

- ### ARRAY-UTILS (ORG.SHIRAKUMO.ARRAY-UTILS)

  - function `(`

    #### `ARRAY-SHIFT`

    `` `ARRAY &KEY (N 1) (FROM 0) TO (ADJUST T) (FILL NIL F-P) (CONTENTS NIL C-P)``)`

        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.

  - function `(`

    #### `ENSURE-ARRAY-SIZE`

    `` `ARRAY NEW-SPACE``)`
    No docstring provided.
  - 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.

  - 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-POSITION

  - 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.

  - 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

  - 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.