Skip to content

Instantly share code, notes, and snippets.

@atifaziz
Created October 3, 2023 13:26
Show Gist options
  • Save atifaziz/aada54a272677fe74be5e74a5b577d1d to your computer and use it in GitHub Desktop.
Save atifaziz/aada54a272677fe74be5e74a5b577d1d to your computer and use it in GitHub Desktop.

MoreLINQ Signatures

Legend:

x y
type Type
() void
obj object
bool bool
bool? bool?
i8 sbyte
u8 byte
i16 short
u16 ushort
i32 int
i32? int?
u32 uint
i64 long
u64 ulong
f32 float
f64 double
dec decimal
ch char
str string
rand Random
error Exception
table DataTable
x x y
a Generic type parameter T
ab Function with 1 argument Func<,>
(a, b) → c Function with 2 arguments Func<,,>
(a, b, c) → d Function with 3 arguments Func<,,,>
() Unit void
(a, b) Tuple of 2 elements ValueTuple<,>
(a, b, c) Tuple of 3 elements ValueTuple<,,>
obj… Sequence of objects IEnumerable
a Sequence of a elements IEnumerable<>
{a} Set of a elements HashSet<>
[a] List or an array of a [] or List<>
k = Equality comparer for k IEqualityComarer<>
k Key TKey
r Result TResult
s, sN State or accumulator TState or TAccumulator
k comparer Comparer for k IComparer<>
ab Quoted function Expresion<Func<,>>
a ordered Ordered sequence of a IOrderedEnumerable<>
(k, v) grouping Grouping of v by key k IGrouping<,>
(k, v) pair Kev-value pair KeyValuePair<,>
[kv] Map from k to v Dictionary<,>
[kv…] Map from k to many v ILookup<,>
{ A | B | C } Enumeration values Enum sub-type

Acquire

  • a… → [a]

Aggregate

  • (a…, s1, (s1, a) → s1, s2, (s2, a) → s2, (s1, s2) → r) → r
  • (a…, s1, (s1, a) → s1, s2, (s2, a) → s2, s3, (s3, a) → s3, (s1, s2, s3) → r) → r
  • (a…, s1, (s1, a) → s1, s2, (s2, a) → s2, s3, (s3, a) → s3, s4, (s4, a) → s4, (s1, s2, s3, s4) → r) → r
  • (a…, s1, (s1, a) → s1, s2, (s2, a) → s2, s3, (s3, a) → s3, s4, (s4, a) → s4, s5, (s5, a) → s5, (s1, s2, s3, s4, s5) → r) → r
  • (a…, s1, (s1, a) → s1, s2, (s2, a) → s2, s3, (s3, a) → s3, s4, (s4, a) → s4, s5, (s5, a) → s5, s6, (s6, a) → s6, (s1, s2, s3, s4, s5, s6) → r) → r
  • (a…, s1, (s1, a) → s1, s2, (s2, a) → s2, s3, (s3, a) → s3, s4, (s4, a) → s4, s5, (s5, a) → s5, s6, (s6, a) → s6, s7, (s7, a) → s7, (s1, s2, s3, s4, s5, s6, s7) → r) → r
  • (a…, s1, (s1, a) → s1, s2, (s2, a) → s2, s3, (s3, a) → s3, s4, (s4, a) → s4, s5, (s5, a) → s5, s6, (s6, a) → s6, s7, (s7, a) → s7, s8, (s8, a) → s8, (s1, s2, s3, s4, s5, s6, s7, s8) → r) → r

AggregateRight

  • (a…, (a, a) → a) → a
  • (a…, b, (a, b) → b) → b
  • (a…, b, (a, b) → b, br) → r

Append

  • (a…, a) → a

Concat

  • (a…, a) → a

Assert

  • (a…, a → bool) → a
  • (a…, a → bool, a → error) → a

AssertCount

  • (a…, i32) → a
  • (a…, i32, (i32, i32) → error) → a

Backsert

  • (a…, a…, i32) → a

Batch

  • (a…, i32) → a……
  • (a…, i32, a… → r) → r

Cartesian

  • (a…, b…, (a, b) → r) → r
  • (a…, b…, c…, (a, b, c) → r) → r
  • (a…, b…, c…, d…, (a, b, c, d) → r) → r
  • (a…, b…, c…, d…, e…, (a, b, c, d, e) → r) → r
  • (a…, b…, c…, d…, e…, f…, (a, b, c, d, e, f) → r) → r
  • (a…, b…, c…, d…, e…, f…, g…, (a, b, c, d, e, f, g) → r) → r
  • (a…, b…, c…, d…, e…, f…, g…, h…, (a, b, c, d, e, f, g, h) → r) → r

Choose

  • (a…, a → (bool, r)) → r

Consume

  • a… → ()

CountBy

  • (a…, ak) → (k, i32) pair…
  • (a…, ak, k =) → (k, i32) pair…

CountDown

  • (a…, i32, (a, i32?) → r) → r

AtLeast

  • (a…, i32) → bool

AtMost

  • (a…, i32) → bool

Exactly

  • (a…, i32) → bool

CountBetween

  • (a…, i32, i32) → bool

CompareCount

  • (a…, b…) → i32

DistinctBy

  • (a…, ak) → a
  • (a…, ak, k =) → a

EndsWith

  • (a…, a…) → bool
  • (a…, a…, a =) → bool

EquiZip

  • (a…, b…, (a, b) → r) → r
  • (a…, b…, c…, (a, b, c) → r) → r
  • (a…, b…, c…, d…, (a, b, c, d) → r) → r

Evaluate

  • () → a… → a

ExceptBy

  • (a…, a…, ak) → a
  • (a…, a…, ak, k =) → a

Exclude

  • (a…, i32, i32) → a

FallbackIfEmpty

  • (a…, a) → a
  • (a…, a, a) → a
  • (a…, a, a, a) → a
  • (a…, a, a, a, a) → a
  • (a…, [a]) → a
  • (a…, a…) → a

FillBackward

  • a… → a
  • (a…, a → bool) → a
  • (a…, a → bool, (a, a) → a) → a

FillForward

  • a… → a
  • (a…, a → bool) → a
  • (a…, a → bool, (a, a) → a) → a

Flatten

  • obj… → obj…
  • (obj…, obj… → bool) → obj…
  • (obj…, obj → obj…) → obj…

Fold

  • (a…, ar) → r
  • (a…, (a, a) → r) → r
  • (a…, (a, a, a) → r) → r
  • (a…, (a, a, a, a) → r) → r
  • (a…, (a, a, a, a, a) → r) → r
  • (a…, (a, a, a, a, a, a) → r) → r
  • (a…, (a, a, a, a, a, a, a) → r) → r
  • (a…, (a, a, a, a, a, a, a, a) → r) → r
  • (a…, (a, a, a, a, a, a, a, a, a) → r) → r
  • (a…, (a, a, a, a, a, a, a, a, a, a) → r) → r
  • (a…, (a, a, a, a, a, a, a, a, a, a, a) → r) → r
  • (a…, (a, a, a, a, a, a, a, a, a, a, a, a) → r) → r
  • (a…, (a, a, a, a, a, a, a, a, a, a, a, a, a) → r) → r
  • (a…, (a, a, a, a, a, a, a, a, a, a, a, a, a, a) → r) → r
  • (a…, (a, a, a, a, a, a, a, a, a, a, a, a, a, a, a) → r) → r
  • (a…, (a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a) → r) → r

ForEach

  • (a…, a → ()) → ()
  • (a…, (a, i32) → ()) → ()

From

  • () → aa
  • (() → a, () → a) → a
  • (() → a, () → a, () → a) → a
  • [() → a] → a

FullGroupJoin

  • (a…, b…, ak, bk) → (k, a…, b…)…
  • (a…, b…, ak, bk, k =) → (k, a…, b…)…
  • (a…, b…, ak, bk, (k, a…, b…) → r) → r
  • (a…, b…, ak, bk, (k, a…, b…) → r, k =) → r

FullJoin

  • (a…, a…, ak, ar, ar, (a, a) → r) → r
  • (a…, a…, ak, ar, ar, (a, a) → r, k =) → r
  • (a…, b…, ak, bk, ar, br, (a, b) → r) → r
  • (a…, b…, ak, bk, ar, br, (a, b) → r, k =) → r

Generate

  • (r, rr) → r

GenerateByIndex

  • i32 → rr

GroupAdjacent

  • (a…, ak) → (k, a) grouping…
  • (a…, ak, k =) → (k, a) grouping…
  • (a…, ak, ab) → (k, b) grouping…
  • (a…, ak, ab, k =) → (k, b) grouping…
  • (a…, ak, (k, a…) → r) → r
  • (a…, ak, (k, a…) → r, k =) → r

Index

  • a… → (i32, a) pair…
  • (a…, i32) → (i32, a) pair…

IndexBy

  • (a…, ak) → (i32, a) pair…
  • (a…, ak, k =) → (i32, a) pair…

Insert

  • (a…, a…, i32) → a

Interleave

  • (a…, [a…]) → a

Lag

  • (a…, i32, (a, a) → r) → r
  • (a…, i32, a, (a, a) → r) → r

Lead

  • (a…, i32, (a, a) → r) → r
  • (a…, i32, a, (a, a) → r) → r

LeftJoin

  • (a…, a…, ak, ar, (a, a) → r) → r
  • (a…, a…, ak, ar, (a, a) → r, k =) → r
  • (a…, b…, ak, bk, ar, (a, b) → r) → r
  • (a…, b…, ak, bk, ar, (a, b) → r, k =) → r

First

  • a… → a

FirstOrDefault

  • a… → a

Last

  • a… → a

LastOrDefault

  • a… → a

Single

  • a… → a

SingleOrDefault

  • a… → a

MaxBy

  • (a…, ak) → a
  • (a…, ak, k comparer) → a

MinBy

  • (a…, ak) → a
  • (a…, ak, k comparer) → a

Move

  • (a…, i32, i32, i32) → a

OrderBy

  • (a…, ak, { Ascending | Descending }) → a ordered
  • (a…, ak, k comparer, { Ascending | Descending }) → a ordered

ThenBy

  • (a ordered, ak, { Ascending | Descending }) → a ordered
  • (a ordered, ak, k comparer, { Ascending | Descending }) → a ordered

OrderedMerge

  • (a…, a…) → a
  • (a…, a…, a comparer) → a
  • (a…, a…, ak) → a
  • (a…, a…, ak, ar, ar, (a, a) → r) → r
  • (a…, a…, ak, ar, ar, (a, a) → r, k comparer) → r
  • (a…, b…, ak, bk, ar, br, (a, b) → r) → r
  • (a…, b…, ak, bk, ar, br, (a, b) → r, k comparer) → r

Pad

  • (a…, i32) → a
  • (a…, i32, a) → a
  • (a…, i32, i32 → a) → a

PadStart

  • (a…, i32) → a
  • (a…, i32, a) → a
  • (a…, i32, i32 → a) → a

Pairwise

  • (a…, (a, a) → r) → r

PartialSort

  • (a…, i32) → a
  • (a…, i32, { Ascending | Descending }) → a
  • (a…, i32, a comparer) → a
  • (a…, i32, a comparer, { Ascending | Descending }) → a

PartialSortBy

  • (a…, i32, ak) → a
  • (a…, i32, ak, { Ascending | Descending }) → a
  • (a…, i32, ak, k comparer) → a
  • (a…, i32, ak, k comparer, { Ascending | Descending }) → a

Partition

  • (a…, a → bool) → (a…, a…)
  • (a…, a → bool, (a…, a…) → r) → r
  • ((bool, a) grouping…, (a…, a…) → r) → r
  • ((bool?, a) grouping…, (a…, a…, a…) → r) → r
  • ((k, a) grouping…, k, (a…, (k, a) grouping…) → r) → r
  • ((k, a) grouping…, k, k =, (a…, (k, a) grouping…) → r) → r
  • ((k, a) grouping…, k, k, (a…, a…, (k, a) grouping…) → r) → r
  • ((k, a) grouping…, k, k, k =, (a…, a…, (k, a) grouping…) → r) → r
  • ((k, a) grouping…, k, k, k, (a…, a…, a…, (k, a) grouping…) → r) → r
  • ((k, a) grouping…, k, k, k, k =, (a…, a…, a…, (k, a) grouping…) → r) → r

Permutations

  • a… → [a]…

Pipe

  • (a…, a → ()) → a

Prepend

  • (a…, a) → a

PreScan

  • (a…, (a, a) → a, a) → a

Random

  • () → i32…
  • rand → i32…
  • i32 → i32…
  • (rand, i32) → i32…
  • (i32, i32) → i32…
  • (rand, i32, i32) → i32…

RandomDouble

  • () → f64…
  • rand → f64…

RandomSubset

  • (a…, i32) → a
  • (a…, i32, rand) → a

Rank

  • a… → i32…
  • (a…, a comparer) → i32…

RankBy

  • (a…, ak) → i32…
  • (a…, ak, k comparer) → i32…

Repeat

  • (a…, i32) → a
  • a… → a

Return

  • aa

RightJoin

  • (a…, a…, ak, ar, (a, a) → r) → r
  • (a…, a…, ak, ar, (a, a) → r, k =) → r
  • (a…, b…, ak, bk, br, (a, b) → r) → r
  • (a…, b…, ak, bk, br, (a, b) → r, k =) → r

RunLengthEncode

  • a… → (a, i32) pair…
  • (a…, a =) → (a, i32) pair…

Scan

  • (a…, (a, a) → a) → a
  • (a…, s, (s, a) → s) → s

ScanBy

  • (a…, ak, ks, (s, k, a) → s) → (k, s) pair…
  • (a…, ak, ks, (s, k, a) → s, k =) → (k, s) pair…

ScanRight

  • (a…, (a, a) → a) → a
  • (a…, b, (a, b) → b) → b

Segment

  • (a…, a → bool) → a……
  • (a…, (a, i32) → bool) → a……
  • (a…, (a, a, i32) → bool) → a……

Sequence

  • (i32, i32) → i32…
  • (i32, i32, i32) → i32…

Shuffle

  • a… → a
  • (a…, rand) → a

SkipLast

  • (a…, i32) → a

SkipUntil

  • (a…, a → bool) → a

Slice

  • (a…, i32, i32) → a

SortedMerge

  • (a…, { Ascending | Descending }, [a…]) → a
  • (a…, { Ascending | Descending }, a comparer, [a…]) → a

Split

  • (a…, a) → a……
  • (a…, a, i32) → a……
  • (a…, a, a… → r) → r
  • (a…, a, i32, a… → r) → r
  • (a…, a, a =) → a……
  • (a…, a, a =, i32) → a……
  • (a…, a, a =, a… → r) → r
  • (a…, a, a =, i32, a… → r) → r
  • (a…, a → bool) → a……
  • (a…, a → bool, i32) → a……
  • (a…, a → bool, a… → r) → r
  • (a…, a → bool, i32, a… → r) → r

StartsWith

  • (a…, a…) → bool
  • (a…, a…, a =) → bool

Subsets

  • a… → [a]…
  • (a…, i32) → [a]…

TagFirstLast

  • (a…, (a, bool, bool) → r) → r

TakeEvery

  • (a…, i32) → a

TakeLast

  • (a…, i32) → a

TakeUntil

  • (a…, a → bool) → a

ToArrayByIndex

  • (a…, a → i32) → [a]
  • (a…, a → i32, ar) → [r]
  • (a…, a → i32, (a, i32) → r) → [r]
  • (a…, i32, a → i32) → [a]
  • (a…, i32, a → i32, ar) → [r]
  • (a…, i32, a → i32, (a, i32) → r) → [r]

ToDataTable

  • (a…, b) → b
  • (a…, [“a → obj”]) → table
  • a… → table
  • (a…, b, [“a → obj”]) → b

ToDelimitedString

  • (a…, str) → str
  • (bool…, str) → str
  • (u8…, str) → str
  • (ch…, str) → str
  • (dec…, str) → str
  • (f64…, str) → str
  • (f32…, str) → str
  • (i32…, str) → str
  • (i64…, str) → str
  • (i8…, str) → str
  • (i16…, str) → str
  • (str…, str) → str
  • (u32…, str) → str
  • (u64…, str) → str
  • (u16…, str) → str

ToDictionary

  • (k, a) pair… → [ka]
  • ((k, a) pair…, k =) → [ka]
  • (k, a)… → [ka]
  • ((k, a)…, k =) → [ka]

ToHashSet

  • a… → {a}
  • (a…, a =) → {a}

ToLookup

  • (k, a) pair… → [ka…]
  • ((k, a) pair…, k =) → [ka…]
  • (k, a)… → [ka…]
  • ((k, a)…, k =) → [ka…]

Trace

  • a… → a
  • (a…, str) → a
  • (a…, a → str) → a

Transpose

  • a…… → a……

TraverseBreadthFirst

  • (a, aa…) → a

TraverseDepthFirst

  • (a, aa…) → a

Unfold

  • (s, sa, a → bool, as, ar) → r

Window

  • (a…, i32) → [a]…

Windowed

  • (a…, i32) → a……

WindowLeft

  • (a…, i32) → [a]…

WindowRight

  • (a…, i32) → [a]…

ZipLongest

  • (a…, b…, (a, b) → r) → r
  • (a…, b…, c…, (a, b, c) → r) → r
  • (a…, b…, c…, d…, (a, b, c, d) → r) → r

ZipShortest

  • (a…, b…, (a, b) → r) → r
  • (a…, b…, c…, (a, b, c) → r) → r
  • (a…, b…, c…, d…, (a, b, c, d) → r) → r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment