express-0.1.2: Dynamically-typed expressions involving applications and variables.

Copyright(c) 2019 Rudy Matela
License3-Clause BSD (see the file LICENSE)
MaintainerRudy Matela <rudy@matela.com.br>
Safe HaskellSafe
LanguageHaskell2010

Data.Express.Utils.List

Description

Re-exports the Data.List module along with additional functions over lists.

Synopsis

Documentation

nubSort :: Ord a => [a] -> [a] Source #

O(n log n). Sorts and remove repetitions. Equivalent to nub . sort.

> nubSort [1,2,3]
[1,2,3]
> nubSort [3,2,1]
[1,2,3]
> nubSort [3,2,1,3,2,1]
[1,2,3]
> nubSort [3,3,1,1,2,2]
[1,2,3]

nubSortBy :: (a -> a -> Ordering) -> [a] -> [a] Source #

isPermutationOf :: Ord a => [a] -> [a] -> Bool Source #

O(n log n). Checks that all elements of the first list are elements of the second.

isSubsetOf :: Ord a => [a] -> [a] -> Bool Source #

O(n log n). Checks that all elements of the first list are elements of the second.

isNub :: Ord a => [a] -> Bool Source #

O(n log n). Checks that all elements are unique. This function is a faster equivalent to the following:

isNub xs  =  nub xs == xs

Examples:

isNub []       =  True
isNub [1,2,3]  =  True
isNub [2,1,2]  =  False

lookupId :: Eq a => a -> [(a, a)] -> a Source #

O(n). Like lookup but returns the key itself if nothing is found.

> lookupId 5 [(1,2),(3,4)]
5
> lookupId 5 [(1,2),(3,4),(5,6)]
6

(+++) :: Ord a => [a] -> [a] -> [a] infixr 5 Source #

module Data.List