[Home] Module Microsoft.FSharp.MLLib.List


Basic operations on lists.

Values

ValueDescription
val append : 'a list -> 'a list -> 'a list
Return a new list that contains the elements of the first list followed by elements of the second
val assoc : 'a -> ('a * 'b) list -> 'b
Lookup key's data in association list, uses (=) equality. Raises [[Not_found]] exception if key not found, in which case you should typically use [[try_assoc]] instead.
val assq : 'a -> ('a * 'b) list -> 'b
See [[assoc]], but uses the physical equality operator (==) for equality tests
val choose : ('a -> 'b option) -> 'a list -> 'b list
Apply the given function to each element of the list. Return the list comprised of the results "x" for each element where the function returns Some(x)
val combine : 'a list -> 'b list -> ('a * 'b) list
Combine the two lists into a list of pairs. The two lists must have equal lengths.
val concat : 'a list list -> 'a list
Return a new list that contains the elements of each the lists in order
val exists : ('a -> bool) -> 'a list -> bool
Test if any element of the collection satisfies the given predicate. If the elements are "i0...iN" then computes "p i0 or ... or p iN".
val exists2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
Test if any corresponding elements of the collection satisfy the given predicate pairwise. If the elements are "i0...iN" and "j0...jN" then computes "p i0 j0 or ... or p iN jN". Raises [[Invalid_argument]] exception if the lists do not zip (have different lengths).
val filter : ('a -> bool) -> 'a list -> 'a list
Return a new collection containing only the elements of the collection for which the given predicate returns "true"
val find : ('a -> bool) -> 'a list -> 'a
Return the first element for which the given function returns "true". Raise Not_found if no such element exists.
val find_all : ('a -> bool) -> 'a list -> 'a list
Return a list containing allthe elements for which the given function returns "true". Same as "filter"
val first : ('a -> 'b option) -> 'a list -> 'b option
Apply the given function to successive elements, returning the first result where function returns "Some(x)" for some x.
val flatten : 'a list list -> 'a list
Return a new list that contains the elements of each the lists in order. Same as concat.
val fold_left : ('b -> 'a -> 'b) -> 'b -> 'a list -> 'b
Apply a function to each element of the collection, threading an 'accumulator' argument through the computation. If the elements are "i0...iN" then computes "f (... (f s i0)...) iN"
val fold_left2 : ('c -> 'a -> 'b -> 'c) -> 'c -> 'a list -> 'b list -> 'c
Apply a function to corresponding elements of two collections, threading an 'accumulator' argument through the computation. The collections must have identical sizes. If the elements are "i0...iN" and "j0...jN" then computes "f (... (f s i0 j0)...) iN jN".
val fold_right : ('a -> 'b -> 'b) -> 'a list -> 'b -> 'b
Apply a function to each element of the collection, threading an 'accumulator' argument through the computation. If the elements are "i0...iN" then computes "f i0 (...(f iN s))".
val fold_right2 : ('a -> 'b -> 'c -> 'c) -> 'a list -> 'b list -> 'c -> 'c
Apply a function to corresponding elements of two collections, threading an 'accumulator' argument through the computation. The collections must have identical sizes. If the elements are "i0...iN" and "j0...jN" then computes "f i0 j0 (...(f iN jN s))".
val for_all : ('a -> bool) -> 'a list -> bool
Test if all elements of the collection satisfy the given predicate. If the elements are "i0...iN" then computes "p i0 && ... && p iN".
val for_all2 : ('a -> 'b -> bool) -> 'a list -> 'b list -> bool
Test if all corresponding elements of the collection satisfy the given predicate pairwise. If the elements are "i0...iN" and "j0...jN" then computes "p i0 j0 && ... && p iN jN". Raises [[Invalid_argument]] if the lists do not zip (have different lengths).
val get_IEnumerator : 'a list -> IEnumerator<'a>
Return an enumerator for performing imperative enumerations over the given collection.
val hd : 'a list -> 'a
Return the first element of the list. Raise (Invalid_argument "hd") if undefined.
val init : int -> (int -> 'a) -> 'a list
Create a list by calling the given generator on each index
val iter : ('a -> unit) -> 'a list -> unit
Apply the given function to each element of the collection.
val iter2 : ('a -> 'b -> unit) -> 'a list -> 'b list -> unit
Apply the given function to two collections simultaneously. The collections must have identical size.
val iteri : (int -> 'a -> unit) -> 'a list -> unit
Apply the given function to each element of the collection. The integer passed to the function indicates the index of element.
val iteri2 : (int -> 'a -> 'b -> unit) -> 'a list -> 'b list -> unit
Apply the given function to two collections simultaneously. The collections must have identical size. The integer passed to the function indicates the index of element.
val length : 'a list -> int
Return the length of the list
val map : ('a -> 'b) -> 'a list -> 'b list
Build a new collection whose elements are the results of applying the given function to each of the elements of the collection.
val map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
Build a new collection whose elements are the results of applying the given function to the corresponding elements of the two collections pairwise.
val mapi : (int -> 'a -> 'b) -> 'a list -> 'b list
Build a new collection whose elements are the results of applying the given function to each of the elements of the collection. The integer index passed to the function indicates the index (from 0) of element being transformed.
val mapi2 : (int -> 'a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
Like mapi, but mapping corresponding elements from two lists of equal length.
val mem : 'a -> 'a list -> bool
Is an element in the list, uses (=) equality.
val mem_assoc : 'a -> ('a * 'b) list -> bool
Does the key have pair in the association list?
val mem_assq : 'a -> ('a * 'b) list -> bool
See [[mem_assoc]], but uses the physical equality operator (==) for equality tests.
val memq : 'a -> 'a list -> bool
See [[mem]], but uses the physical equality operator (==) for equality tests.
val nonempty : 'a list -> bool
Return true if the list is not empty.
val nth : 'a list -> int -> 'a
Index into the list. The first element has index 0.
val of_array : 'a array -> 'a list
Build a collection from the given array
val of_ICollection : #ICollection<'a> -> 'a list
Build a new collection from any type that supports the .NET ICollection interface Unspecified behaviour if the underlying collection is mutated.
val of_IEnumerable : #IEnumerable<'a> -> 'a list
Build a new collection from the given enumerable object
val of_List : List<'a> -> 'a list
val of_stream : 'a t -> 'a list
Build a collection from the given lazy list
val partition : ('a -> bool) -> 'a list -> 'a list * 'a list
Split the collection into two collections, containing the elements for which the given predicate returns "true" and "false" respectively
val remove_assoc : 'a -> ('a * 'b) list -> ('a * 'b) list
Remove pair for key from the association list (if it's there).
val remove_assq : 'a -> ('a * 'b) list -> ('a * 'b) list
See [[remove_assoc]], but uses the physical equality operator (==) for equality tests.
val rev : 'a list -> 'a list
Return a new list with the elements in reverse order
val rev_append : 'a list -> 'a list -> 'a list
"rev_append l1 l2" evaluates to "append (rev l1) l2"
val rev_map : ('a -> 'b) -> 'a list -> 'b list
"rev_map f l1" evaluates to "map f (rev l1)"
val rev_map2 : ('a -> 'b -> 'c) -> 'a list -> 'b list -> 'c list
"rev_map2 f l1 l2" evaluates to "map2 f (rev l1) (rev l2)"
val sort : ('a -> 'a -> int) -> 'a list -> 'a list
Sort the given list using the given comparison function
val split : ('a * 'b) list -> 'a list * 'b list
Split a list of pairs into two lists
val stable_sort : ('a -> 'a -> int) -> 'a list -> 'a list
Sort the given list using the given comparison function, preserving order for equal elements.
val tl : 'a list -> 'a list
Return the first element of the list. Raise (Invalid_argument "tl") if undefined.
val to_array : 'a list -> 'a array
Build an array from the given collection
val to_ICollection : 'a list -> ICollection<'a>
Return a view of the collection as a .NET collection. Results in a ReadOnly collection.
val to_IEnumerable : 'a list -> IEnumerable<'a>
Return a view of the collection as an enumerable object
val to_List : 'a list -> List<'a>
val to_stream : 'a list -> 'a t
Build a lazy list from the given collection
val try_assoc : 'a -> ('a * 'b) list -> 'b option
Lookup key's data in association list, uses (=) equality, returning "Some data" or "None".
val try_assq : 'a -> ('a * 'b) list -> 'b option
See [[try_assoc]], but uses the physical equality operator (==) for equality tests.
val tryfind : ('a -> bool) -> 'a list -> 'a option
Return the first element for which the given function returns "true". Return None if no such element exists.

Deprecated Values

ValueDescription
val foreach : 'a list -> ('a -> unit) -> unit

Deprecated: This member is deprecated. Use "x |> CollectionType.iter" instead.

Deprecated: Apply the given function to each element of the collection.
val foreach2 : 'a list -> 'b list -> ('a -> 'b -> unit) -> unit

Deprecated: This member is deprecated. Use "CollectionType.iter2" instead.

Deprecated: Use iter2.
val foreachi : 'a list -> (int -> 'a -> unit) -> unit

Deprecated: This member is deprecated. Use "CollectionType.iteri" instead.

Deprecated: Apply the given function to each element of the collection. The integer passed to the function indicates the index of element.
val foreachi2 : 'a list -> 'b list -> (int -> 'a -> 'b -> unit) -> unit

Deprecated: This member is deprecated. Use "CollectionType.iteri2" instead.

Deprecated: Apply the given function to corresponding elements of the two collections pairwise. The integer passed to the function indicates the index of element.
val transform : 'a list -> ('a -> 'b) -> 'b list

Deprecated: This member is deprecated. Use "x |> CollectionType.map" instead.

Deprecated: Build a new collection whose elements are the results of applying the given function to each of the elements of the collection.
val transform2 : 'a list -> 'b list -> ('a -> 'b -> 'c) -> 'c list

Deprecated: This member is deprecated. Use "x |> CollectionType.map" instead.

Deprecated: Build a new collection whose elements are the results of applying the given function to the corresponding elements of the two collections pairwise.
val transformi : 'a list -> (int -> 'a -> 'b) -> 'b list

Deprecated: This member is deprecated. Use "x |> CollectionType.map" instead.

Deprecated: Build a new collection whose elements are the results of applying the given function to each of the elements of the collection. The integer index passed to the function indicates the index of element being transformed.
val transformi2 : 'a list -> 'b list -> (int -> 'a -> 'b -> 'c) -> 'c list

Deprecated: This member is deprecated. Use "CollectionType.mapi2" instead.

Deprecated:

See Also

Microsoft.FSharp.MLLib


Documentation for assembly mllib, version 1.1.10.1, generated using F# version 1.1.10.1