LanguageExt.Core

LanguageExt.Core Immutable Collections Arr

Contents

struct Arr <A> Source #

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

Indexers

this [ A ] Source #

Index accessor

Properties

property Arr<A> Empty Source #

Empty array

property Lens<Arr<A>, A> head Source #

Head lens

property Lens<Arr<A>, Option<A>> headOrNone Source #

Head or none lens

property Lens<Arr<A>, A> last Source #

Last 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 bool IsEmpty Source #

Is the stack empty

property int Count Source #

Number of items in the stack

property int Length Source #

Alias of Count

property Arr<A> AdditiveIdentity Source #

Constructors

constructor Arr (IEnumerable<A> initial) Source #

Ctor

constructor Arr (ReadOnlySpan<A> initial) Source #

Ctor

Methods

method Lens<Arr<A>, A> item (int index) Source #

Item at index lens

method Lens<Arr<A>, Option<A>> itemOrNone (int index) Source #

Item or none at index lens

method Lens<Arr<A>, Arr<B>> map <B> (Lens<A, B> lens) Source #

Lens map

method Arr<A> Add (A valueToAdd) Source #

Add an item to the end of the array

method Arr<A> AddRange (IEnumerable<A> items) Source #

Add a range of items to the end of the array

method Arr<A> Clear () Source #

Clear the array

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 #

where EQ : Eq<A>

Find the index of an item

method int LastIndexOf <EQ> (A item, int index = -1, int count = -1) Source #

where EQ : Eq<A>

Find the index of an item

method Arr<A> Insert (int index, A valueToInsert) Source #

Insert value at specified index

method Arr<A> InsertRange (int index, IEnumerable<A> items) Source #

Insert range of values at specified index

method Arr<A> Remove (A valueToRemove) Source #

Remove an item from the array

method Arr<A> Remove (A valueToRemove, IEqualityComparer<A> equalityComparer) Source #

Remove an item from the array

method Arr<A> Remove <EQ> (A valueToRemove) Source #

where EQ : Eq<A>

Remove an item from the array

method Arr<A> RemoveAll (Predicate<A> pred) Source #

Remove all items that match a predicate

method Arr<A> RemoveAt (int index) Source #

Remove item at location

Parameters

param index
returns

method Arr<A> RemoveRange (int index, int count) Source #

Remove a range of items

method Arr<A> SetItem (int index, A valueToSet) Source #

Set an item at the specified index

method EnumerableM<A> AsEnumerable () Source #

method Seq<A> ToSeq () 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 EnumerableM<A> Skip (int amount) Source #

method Arr<A> Reverse () Source #

Reverse the order of the items in the array

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 Arr<B> Map <B> (Func<A, B> map) Source #

Map

method K<F, Arr<B>> Traverse <F, B> (Func<A, K<F, B>> f) Source #

where F : Applicative<F>

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 Arr<A> Filter (Func<A, bool> pred) Source #

Filter

method Arr<A> Combine (Arr<A> rhs) Source #

method bool Equals (object? obj) Source #

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

method int CompareTo (object? obj) Source #

method bool Equals (Arr<A> other) Source #

method int CompareTo (Arr<A> other) Source #

method Arr<B> Bind <B> (Func<A, Arr<B>> f) Source #

Operators

operator + (Arr<A> lhs, A rhs) Source #

operator + (A lhs, Arr<A> rhs) Source #

operator + (Arr<A> lhs, Arr<A> rhs) Source #

operator == (Arr<A> lhs, Arr<A> rhs) Source #

operator != (Arr<A> lhs, Arr<A> rhs) Source #

operator > (Arr<A> left, Arr<A> right) Source #

operator >= (Arr<A> left, Arr<A> right) Source #

operator < (Arr<A> left, Arr<A> right) Source #

operator <= (Arr<A> left, Arr<A> right) Source #

struct Enumerator Source #

Properties

property A Current Source #

Methods

method bool MoveNext () Source #

class ArrExtensions Source #

Methods

method Arr<A> As <A> (this K<Arr, A> xs) Source #

method A[] Flatten <A> (this A[][] ma) Source #

Monadic join

method Arr<A> Flatten <A> (this Arr<Arr<A>> ma) Source #

Monadic join

method Arr<A> Filter <A> (this Arr<A> ma, Func<A, bool> f) Source #

method Arr<A> Where <A> (this Arr<A> ma, Func<A, bool> f) Source #

method Arr<B> Map <A, B> (this Arr<A> ma, Func<A, B> f) Source #

method Arr<B> Select <A, B> (this Arr<A> ma, Func<A, B> f) Source #

method Arr<B> Bind <A, B> (this Arr<A> ma, Func<A, Arr<B>> f) Source #

method Arr<B> SelectMany <A, B> (this Arr<A> ma, Func<A, Arr<B>> f) Source #

method Arr<C> SelectMany <A, B, C> (this Arr<A> ma, Func<A, Arr<B>> bind, Func<A, B, C> project) Source #

method IQueryable<A> AsQueryable <A> (this Arr<A> source) Source #

Convert to a queryable

class Arr Source #

Methods

method Arr<T> empty <T> () Source #

Create an empty array

method Arr<T> create <T> () Source #

Create a new empty array

Parameters

returns

Lst T

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

method Arr<T> rev <T> (Arr<T> array) Source #

Reverses the array (Reverse in LINQ)

Parameters

type T

Array item type

param array

Array to reverse

returns

Reversed list

method A[] flatten <A> (A[][] ma) Source #

Monadic join

method Arr<A> flatten <A> (Arr<Arr<A>> ma) Source #

Monadic join

class Arr Source #