query
On this page

uniqueStrings

lib.lists.uniqueStrings

Docs pulled from | This Revision | 35 minutes ago


Removes duplicate strings from the list. O(n log n) complexity.

Order is not preserved.

All elements of the list must be strings without context.

This function fails when the list contains a non-string element or a string with context. In that case use lib.lists.unique instead.

Inputs

list

List of strings

Type

uniqueStrings :: [ String ] -> [ String ]

Examples

lib.lists.uniqueStrings usage example

uniqueStrings [ "foo" "bar" "foo" ]
=> [ "bar" "foo" ] # order is not preserved

Noogle detected

Aliases

Implementation

The following is the current implementation of this function.

uniqueStrings = list: attrNames (groupBy id list);