Resizable array types for algorithms where size isn't known upfront.
Provides mutable-size wrappers around primitive arrays that can be resized down (but not up) from their initial capacity. Use cases include algorithms like Knuth histogram binning where the final array size depends on the data.
Three types are provided:
All operations respect the current size (not capacity). Map/filter operations return fixed arrays (DoubleArray, LongArray, ObjectArray).
Resizable array types for algorithms where size isn't known upfront. Provides mutable-size wrappers around primitive arrays that can be resized down (but not up) from their initial capacity. Use cases include algorithms like Knuth histogram binning where the final array size depends on the data. Three types are provided: - ResizableDoubleArray for double values - ResizableLongArray for long values - ResizableObjectArray for arbitrary objects All operations respect the current size (not capacity). Map/filter operations return fixed arrays (DoubleArray, LongArray, ObjectArray).
(capacity arr)Returns the maximum capacity of a resizable array.
Returns the maximum capacity of a resizable array.
(resizable-double-array capacity)(resizable-double-array capacity initial-size)Creates a ResizableDoubleArray with given capacity. With one argument, creates array with size equal to capacity. With two arguments, creates array with given capacity and initial size. The initial size must be between 0 and capacity (inclusive).
Creates a ResizableDoubleArray with given capacity. With one argument, creates array with size equal to capacity. With two arguments, creates array with given capacity and initial size. The initial size must be between 0 and capacity (inclusive).
(resizable-double-array? x)Returns true if x is a ResizableDoubleArray.
Returns true if x is a ResizableDoubleArray.
(resizable-long-array capacity)(resizable-long-array capacity initial-size)Creates a ResizableLongArray with given capacity. With one argument, creates array with size equal to capacity. With two arguments, creates array with given capacity and initial size. The initial size must be between 0 and capacity (inclusive).
Creates a ResizableLongArray with given capacity. With one argument, creates array with size equal to capacity. With two arguments, creates array with given capacity and initial size. The initial size must be between 0 and capacity (inclusive).
(resizable-long-array? x)Returns true if x is a ResizableLongArray.
Returns true if x is a ResizableLongArray.
(resizable-object-array capacity)(resizable-object-array capacity initial-size)Creates a ResizableObjectArray with given capacity. With one argument, creates array with size equal to capacity. With two arguments, creates array with given capacity and initial size. The initial size must be between 0 and capacity (inclusive).
Creates a ResizableObjectArray with given capacity. With one argument, creates array with size equal to capacity. With two arguments, creates array with given capacity and initial size. The initial size must be between 0 and capacity (inclusive).
(resizable-object-array? x)Returns true if x is a ResizableObjectArray.
Returns true if x is a ResizableObjectArray.
(resize! arr new-size)Resizes a resizable array to a new size. The new size must be between 0 and capacity (inclusive). Returns the new size.
Resizes a resizable array to a new size. The new size must be between 0 and capacity (inclusive). Returns the new size.
(set-fixed-array-constructors! constructors)Called by criterium.array to provide constructors for fixed array types.
Called by criterium.array to provide constructors for fixed array types.
(to-fixed arr)Converts a resizable array to a fixed array of the same element type. Creates a new array containing only the active elements (0 to size-1). ResizableDoubleArray -> DoubleArray, ResizableLongArray -> LongArray, ResizableObjectArray -> ObjectArray.
Converts a resizable array to a fixed array of the same element type. Creates a new array containing only the active elements (0 to size-1). ResizableDoubleArray -> DoubleArray, ResizableLongArray -> LongArray, ResizableObjectArray -> ObjectArray.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |