Contents
- Arr <A>
- Empty
- Arr (IEnumerable<A> initial)
- Arr (ReadOnlySpan<A> initial)
- AsSpan ()
- AsSpan (int start)
- AsSpan (int start, int count)
- Splice (int start)
- Splice (int start, int count)
- Tail
- head
- headOrNone
- last
- lastOrNone
- item (int index)
- itemOrNone (int index)
- map <B> (Lens<A, B> lens)
- this []
- Case
- IsEmpty
- Count
- Length
- Add (A valueToAdd)
- AddRange (IEnumerable<A> items)
- Clear ()
- GetEnumerator ()
- IndexOf (A item, int index = 0, int count = -1, IEqualityComparer<A>? equalityComparer = null)
- LastIndexOf (A item, int index = -1, int count = -1, IEqualityComparer<A>? equalityComparer = null)
- IndexOf <EQ> (A item, int index = 0, int count = -1)
- LastIndexOf <EQ> (A item, int index = -1, int count = -1)
- Insert (int index, A valueToInsert)
- InsertRange (int index, IEnumerable<A> items)
- Remove (A valueToRemove)
- Remove (A valueToRemove, IEqualityComparer<A> equalityComparer)
- Remove <EQ> (A valueToRemove)
- RemoveAll (Predicate<A> pred)
- RemoveAt (int index)
- RemoveRange (int index, int count)
- SetItem (int index, A valueToSet)
- AsIterable ()
- ToSeq ()
- ToString ()
- ToFullString (string separator = ", ")
- ToFullArrayString (string separator = ", ")
- Skip (int amount)
- Reverse ()
- Do (Action<A> f)
- Map <B> (Func<A, B> map)
- Traverse <F, B> (Func<A, K<F, B>> f)
- TraverseM <M, B> (Func<A, K<M, B>> f)
- Filter (Func<A, bool> pred)
- + (Arr<A> lhs, A rhs)
- + (A lhs, Arr<A> rhs)
- + (Arr<A> lhs, Arr<A> rhs)
- | (Arr<A> x, K<Arr, A> y)
- | (K<Arr, A> x, Arr<A> y)
- Combine (Arr<A> rhs)
- Equals (object? obj)
- GetHashCode ()
- CompareTo (object? obj)
- Equals (Arr<A> other)
- CompareTo (Arr<A> other)
- == (Arr<A> lhs, Arr<A> rhs)
- != (Arr<A> lhs, Arr<A> rhs)
- Bind <B> (Func<A, Arr<B>> f)
- > (Arr<A> left, Arr<A> right)
- >= (Arr<A> left, Arr<A> right)
- < (Arr<A> left, Arr<A> right)
- <= (Arr<A> left, Arr<A> right)
- AdditiveIdentity
- Enumerator
- Arr
- empty <T> ()
- create <T> ()
- singleton <A> (A value)
- create <T> (ReadOnlySpan<T> items)
- create <T> (params T[] items)
- createRange <T> (IEnumerable<T> items)
- add <T> (Arr<T> array, T value)
- addRange <T> (Arr<T> array, IEnumerable<T> value)
- remove <T> (Arr<T> array, T value)
- removeAt <T> (Arr<T> array, int index)
- rev <T> (T[] array)
- rev <T> (Arr<T> array)
- flatten <A> (A[][] ma)
- flatten <A> (Arr<Arr<A>> ma)
Sub modules
| Extensions |
| Operators |
| Prelude |
| Trait |
Immutable array Native array O(1) read performance. Modifications require copying of the entire array to generate the newly mutated version. This is will be very expensive for large arrays.
Parameters
| type | A | Value type |
Properties
property Lens<Arr<A>, Option<A>> headOrNone Source #
Head or none lens
property Lens<Arr<A>, Option<A>> lastOrNone Source #
Last or none lens
property object? Case Source #
Reference version for use in pattern-matching
Empty collection = result is null
Singleton collection = result is A
More = result is (A, Seq〈A〉) -- head and tail
Example:
var res = arr.Case switch
{
A value => ...,
(var x, var xs) => ...,
_ => ...
}
property Arr<A> AdditiveIdentity Source #
Constructors
Methods
method ReadOnlySpan<A> AsSpan () Source #
Create a readonly span of this array. This doesn't do any copying, so it is very fast.
Parameters
| param | start | Offset from the beginning of the array |
| param | count | The number of items to take. This will be clamped to the maximum number of items available |
| returns | A read-only span of values | |
method ReadOnlySpan<A> AsSpan (int start) Source #
Create a readonly sub-span of this array. This doesn't do any copying, so is very fast, but be aware that any items outside the splice are still active.
Parameters
| param | start | Offset from the beginning of the array |
| returns | A read-only span of values | |
method ReadOnlySpan<A> AsSpan (int start, int count) Source #
Create a readonly sub-span of this array. This doesn't do any copying, so is very fast, but be aware that any items outside the splice are still active.
Parameters
| param | start | Offset from the beginning of the array |
| param | count | The number of items to take. This will be clamped to the maximum number of items available |
| returns | A read-only span of values | |
method Arr<A> Splice (int start) Source #
Create a subarray of this array. This doesn't do any copying, so is very fast, but be aware that any items outside the splice are still active.
Parameters
| param | start | Offset from the beginning of the array |
| returns | ||
method Arr<A> Splice (int start, int count) Source #
Create a subarray of this array. This doesn't do any copying, so is very fast, but be aware that any items outside the splice are still active.
Parameters
| param | start | Offset from the beginning of the array |
| param | count | The number of items to take. This will be clamped to the maximum number of items available |
| returns | ||
method Lens<Arr<A>, Option<A>> itemOrNone (int index) Source #
Item or none at index lens
method Enumerator GetEnumerator () Source #
Get enumerator
method int IndexOf (A item, int index = 0, int count = -1, IEqualityComparer<A>? equalityComparer = null) Source #
Find the index of an item
method int LastIndexOf (A item, int index = -1, int count = -1, IEqualityComparer<A>? equalityComparer = null) Source #
Find the index of an item
method int IndexOf <EQ> (A item, int index = 0, int count = -1) Source #
Find the index of an item
method int LastIndexOf <EQ> (A item, int index = -1, int count = -1) Source #
Find the index of an item
method Arr<A> InsertRange (int index, IEnumerable<A> items) Source #
Insert range of values at specified index
method Arr<A> Remove (A valueToRemove, IEqualityComparer<A> equalityComparer) Source #
Remove an item from the array
method Arr<A> RemoveRange (int index, int count) Source #
Remove a range of items
method Iterable<A> AsIterable () Source #
method string ToString () Source #
Format the collection as [a, b, c, ...]
The ellipsis is used for collections over 50 items
To get a formatted string with all the items, use ToFullString
or ToFullArrayString.
method string ToFullString (string separator = ", ") Source #
Format the collection as a, b, c, ...
method string ToFullArrayString (string separator = ", ") Source #
Format the collection as [a, b, c, ...]
method Arr<A> Do (Action<A> f) Source #
Impure iteration of the bound values in the structure
Parameters
| returns | Returns the original unmodified structure | |
method K<F, Arr<B>> Traverse <F, B> (Func<A, K<F, B>> f) Source #
Map each element of a structure to an action, evaluate these actions from left to right, and collect the results.
Parameters
| type | F | Applicative functor trait |
| type | B | Bound value (output) |
| param | f | |
| param | ta | Traversable structure |
method K<M, Arr<B>> TraverseM <M, B> (Func<A, K<M, B>> f) Source #
Map each element of a structure to an action, evaluate these actions from left to right, and collect the results.
Parameters
| type | M | Monad trait |
| type | B | Bound value (output) |
| param | f | |
| param | ta | Traversable structure |
method int GetHashCode () Source #
Get the hash code Lazily (and once only) calculates the hash from the elements in the array Empty array hash == 0
Operators
struct Enumerator Source #
Methods
method Arr<A> singleton <A> (A value) Source #
Create a singleton array
Parameters
| param | value | Single value |
| returns | Collection with a single item in it | |
method Arr<T> create <T> (ReadOnlySpan<T> items) Source #
Create an array from a initial set of items
Parameters
| param | items | Items |
| returns | Lst T | |
method Arr<T> create <T> (params T[] items) Source #
Create an array from a initial set of items
Parameters
| param | items | Items |
| returns | Lst T | |
method Arr<T> createRange <T> (IEnumerable<T> items) Source #
Create an array from an initial set of items
Parameters
| param | items | Items |
| returns | Lst T | |
method Arr<T> add <T> (Arr<T> array, T value) Source #
Add an item to the array
Parameters
| param | array | Array |
| param | value | Item to add |
| returns | A new Lst T | |
method Arr<T> addRange <T> (Arr<T> array, IEnumerable<T> value) Source #
Add a range of items to the array
Parameters
| param | array | Array |
| param | value | Items to add |
| returns | A new Lst T | |
method Arr<T> remove <T> (Arr<T> array, T value) Source #
Remove an item from the array
Parameters
| param | array | Array |
| param | value | value to remove |
| returns | A new Lst T | |
method Arr<T> removeAt <T> (Arr<T> array, int index) Source #
Remove an item at a specified index in the array
Parameters
| param | array | Array |
| param | index | Index of item to remove |
| returns | A new Lst T | |
method T[] rev <T> (T[] array) Source #
Reverses the array (Reverse in LINQ)
Parameters
| type | T | Array item type |
| param | array | Array to reverse |
| returns | Reversed list | |