File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -156,6 +156,13 @@ module NonEmptyList =
156156 /// <returns >The resulting average.</returns >
157157 let inline averageBy ( projection : 'T -> ^U ) list = List.averageBy projection ( list.Head :: list.Tail)
158158
159+ /// <summary >Returns a list that contains no duplicate entries according to the generic hash and equality comparisons
160+ /// on the keys returned by the given key-generating function.
161+ /// If an element occurs multiple times in the list then the later occurrences are discarded.</summary >
162+ /// <param name =" list " >The input list.</param >
163+ /// <returns >The resulting list without duplicates.</returns >
164+ let distinct ( list : NonEmptyList < 'T >) = list |> Seq.distinct |> ofSeq
165+
159166 /// <summary >Applies a function to each element of the list, threading an accumulator argument
160167 /// through the computation. Apply the function to the first two elements of the list.
161168 /// Then feed this result into the function along with the third element and so on.
Original file line number Diff line number Diff line change @@ -518,6 +518,13 @@ module NonEmptySeq =
518518 let replace ( oldValue : NonEmptySeq < 'T >) ( newValue : NonEmptySeq < 'T >) ( source : NonEmptySeq < 'T >) : NonEmptySeq < 'T > =
519519 Seq.replace oldValue newValue source |> unsafeOfSeq
520520
521+ /// <summary >Returns a sequence that contains no duplicate entries according to the generic hash and equality comparisons
522+ /// on the keys returned by the given key-generating function.
523+ /// If an element occurs multiple times in the sequence then the later occurrences are discarded.</summary >
524+ /// <param name =" source " >The input sequence.</param >
525+ /// <returns >The resulting sequence without duplicates.</returns >
526+ let distinct ( source : NonEmptySeq < 'T >) = source |> Seq.distinct |> ofSeq
527+
521528 /// <summary >Applies a function to each element of the sequence, threading an accumulator argument
522529 /// through the computation. Apply the function to the first two elements of the sequence.
523530 /// Then feed this result into the function along with the third element and so on.
You can’t perform that action at this time.
0 commit comments