FSharpx.Collections


List Module

Extensions for F#'s List module.

Functions and values

Function or value Description

List.catOptions xs

Full Usage: List.catOptions xs

Parameters:
Returns: 'a list

The catOptions function takes a list of Options and returns a list of all the Some values.

xs : Option<'a> list
Returns: 'a list

List.choice1s xs

Full Usage: List.choice1s xs

Parameters:
Returns: 'a list

Extracts from a list of Choice all the Choice1Of2 elements. All the Choice1Of2 elements are extracted in order.

xs : Choice<'a, 'b> list
Returns: 'a list

List.choice2s xs

Full Usage: List.choice2s xs

Parameters:
Returns: 'b list

Extracts from a list of Choice all the Choice2Of2 elements. All the Choice2Of2 elements are extracted in order.

xs : Choice<'a, 'b> list
Returns: 'b list

List.cons hd tl

Full Usage: List.cons hd tl

Parameters:
    hd : 'a
    tl : 'a list

Returns: 'a list

Curried cons

hd : 'a
tl : 'a list
Returns: 'a list

List.equalsWith eq xs ys

Full Usage: List.equalsWith eq xs ys

Parameters:
    eq : 'a -> 'a -> bool
    xs : 'a list
    ys : 'a list

Returns: bool

Compares two lists for equality using the given comparison function, element by element.

eq : 'a -> 'a -> bool
xs : 'a list
ys : 'a list
Returns: bool

List.fill total elem list

Full Usage: List.fill total elem list

Parameters:
    total : int
    elem : 'a
    list : 'a list

Returns: 'a list
total : int
elem : 'a
list : 'a list
Returns: 'a list

List.groupNeighboursBy projection source

Full Usage: List.groupNeighboursBy projection source

Parameters:
    projection : 'T -> 'Key
    source : 'T list

Returns: ('Key * 'T list) list

Applies a key-generating function to each element of a list and yields a list of unique keys and a list of all elements that have each key. This function groups together only neighbouring elements in the list.

projection : 'T -> 'Key
source : 'T list
Returns: ('Key * 'T list) list

List.lift2 f l1 l2

Full Usage: List.lift2 f l1 l2

Parameters:
    f : 'a -> 'b -> 'c
    l1 : 'a list
    l2 : 'b list

Returns: 'c list
f : 'a -> 'b -> 'c
l1 : 'a list
l2 : 'b list
Returns: 'c list

List.mapAccum f s l

Full Usage: List.mapAccum f s l

Parameters:
    f : 'a -> 'b -> 'a * 'c
    s : 'a
    l : 'b list

Returns: 'a * 'c list

Behaves like a combination of map and fold; it applies a function to each element of a list, passing an accumulating parameter from left to right, and returning a final value of this accumulator together with the new list.

f : 'a -> 'b -> 'a * 'c
s : 'a
l : 'b list
Returns: 'a * 'c list

List.mapIf pred f

Full Usage: List.mapIf pred f

Parameters:
    pred : 'a -> bool
    f : 'a -> 'a

Returns: 'a list -> 'a list
pred : 'a -> bool
f : 'a -> 'a
Returns: 'a list -> 'a list

List.merge a b

Full Usage: List.merge a b

Parameters:
    a : 'a list
    b : 'a list

Returns: 'a list

Merges two sequences by the default comparer for 'T

a : 'a list
b : 'a list
Returns: 'a list

List.mergeBy f a b

Full Usage: List.mergeBy f a b

Parameters:
    f : 'a -> 'b
    a : 'a list
    b : 'a list

Returns: 'a list

Merges to sequences using the given function to transform the elements for comparision

f : 'a -> 'b
a : 'a list
b : 'a list
Returns: 'a list

List.pad amt elem list

Full Usage: List.pad amt elem list

Parameters:
    amt : int
    elem : 'a
    list : 'a list

Returns: 'a list
amt : int
elem : 'a
list : 'a list
Returns: 'a list

List.partitionChoices xs

Full Usage: List.partitionChoices xs

Parameters:
Returns: 'a list * 'b list

Partitions a list of Choice into two lists. All the Choice1Of2 elements are extracted, in order, to the first component of the output. Similarly the Choice2Of2 elements are extracted to the second component of the output.

xs : Choice<'a, 'b> list
Returns: 'a list * 'b list

List.singleton x

Full Usage: List.singleton x

Parameters:
    x : 'a

Returns: 'a list
x : 'a
Returns: 'a list

List.skip n l

Full Usage: List.skip n l

Parameters:
    n : int
    l : 'a list

Returns: 'a list
n : int
l : 'a list
Returns: 'a list

List.skipUntil pred l

Full Usage: List.skipUntil pred l

Parameters:
    pred : 'a -> bool
    l : 'a list

Returns: 'a list
pred : 'a -> bool
l : 'a list
Returns: 'a list

List.skipWhile pred l

Full Usage: List.skipWhile pred l

Parameters:
    pred : 'a -> bool
    l : 'a list

Returns: 'a list
pred : 'a -> bool
l : 'a list
Returns: 'a list

List.span pred l

Full Usage: List.span pred l

Parameters:
    pred : 'a -> bool
    l : 'a list

Returns: 'a list * 'a list
pred : 'a -> bool
l : 'a list
Returns: 'a list * 'a list

List.split pred l

Full Usage: List.split pred l

Parameters:
    pred : 'a -> bool
    l : 'a list

Returns: 'a list * 'a list
pred : 'a -> bool
l : 'a list
Returns: 'a list * 'a list

List.splitAt n l

Full Usage: List.splitAt n l

Parameters:
    n : int
    l : 'a list

Returns: 'a list * 'a list
n : int
l : 'a list
Returns: 'a list * 'a list

List.take n l

Full Usage: List.take n l

Parameters:
    n : int
    l : 'a list

Returns: 'a list
n : int
l : 'a list
Returns: 'a list

List.takeUntil pred l

Full Usage: List.takeUntil pred l

Parameters:
    pred : 'a -> bool
    l : 'a list

Returns: 'a list
pred : 'a -> bool
l : 'a list
Returns: 'a list

List.takeWhile pred l

Full Usage: List.takeWhile pred l

Parameters:
    pred : 'a -> bool
    l : 'a list

Returns: 'a list
pred : 'a -> bool
l : 'a list
Returns: 'a list

List.transpose lst

Full Usage: List.transpose lst

Parameters:
    lst : 'a list list

Returns: 'a list list
lst : 'a list list
Returns: 'a list list