Eq a => [a] -> [a] -> [a]
The \\ function is list difference ((non-associative). In the result of xs \\ ys, the first occurrence of each element of ys in turn (if any) has been removed from xs. Thus
> (xs ++ ys) \\ xs == ys.
It is a special case of deleteFirstsBy, which allows the programmer to supply their own equality test.
The intersect function takes the list intersection of two lists. For example,
> [1,2,3,4] `intersect` [2,4,6,8] == [2,4]
If the first list contains duplicates, so will the result.
> [1,2,2,3,4] `intersect` [6,4,4,2] == [2,2,4]
It is a special case of intersectBy, which allows the programmer to supply their own equality test.
The union function returns the list union of the two lists. For example,
> "dog" `union` "cow" == "dogcw"
Duplicates, and elements of the first list, are removed from the the second list, but if the first list contains duplicates, so will the result. It is a special case of unionBy, which allows the programmer to supply their own equality test.
Append two lists, i.e.,
> [x1, ..., xm] ++ [y1, ..., yn] == [x1, ..., xm, y1, ..., yn]
> [x1, ..., xm] ++ [y1, ...] == [x1, ..., xm, y1, ...]
If the first list is not finite, the result is the first list.
The stripPrefix function drops the given prefix from a list. It returns Nothing if the list did not start with the prefix given, or Just the list after the prefix, if it does.
> stripPrefix "foo" "foobar" == Just "bar"
> stripPrefix "foo" "foo" == Just ""
> stripPrefix "foo" "barfoo" == Nothing
> stripPrefix "foo" "barfoobaz" == Nothing
delete x removes the first occurrence of x from its list argument. For example,
> delete 'a' "banana" == "bnana"
It is a special case of deleteBy, which allows the programmer to supply their own equality test.
The deleteFirstsBy function takes a predicate and two lists and returns the first list with the first occurrence of each element of the second list removed.
The unionBy function is the non-overloaded version of union.
intercalate xs xss is equivalent to (concat (intersperse xs xss)). It inserts the list xs in between the lists in xss and concatenates the result.
Replaces all instances of a value in a list by another value.
The intersperse function takes an element and a list and `intersperses' that element between the elements of the list. For example,
> intersperse ',' "abcde" == "a,b,c,d,e"
Combine two paths, if the second path isAbsolute, then it returns the second.
> Valid x => combine (takeDirectory x) (takeFileName x) `equalFilePath` x
> Posix: combine "/" "test" == "/test"
> Posix: combine "home" "bob" == "home/bob"
> Windows: combine "home" "bob" == "home\\bob"
> Windows: combine "home" "/bob" == "/bob"
Join a drive and the rest of the path.
> uncurry joinDrive (splitDrive x) == x
> Windows: joinDrive "C:" "foo" == "C:foo"
> Windows: joinDrive "C:\\" "bar" == "C:\\bar"
> Windows: joinDrive "\\\\share" "foo" == "\\\\share\\foo"
> Windows: joinDrive "/:" "foo" == "/:\\foo"
Contract a filename, based on a relative path.
There is no corresponding makeAbsolute function, instead use System.Directory.canonicalizePath which has the same effect.
> Valid y => equalFilePath x y || (isRelative x && makeRelative y x == x) || equalFilePath (y </> makeRelative y x) x
> makeRelative x x == "."
> null y || equalFilePath (makeRelative x (x </> y)) y || null (takeFileName x)
> Windows: makeRelative "C:\\Home" "c:\\home\\bob" == "bob"
> Windows: makeRelative "C:\\Home" "c:/home/bob" == "bob"
> Windows: makeRelative "C:\\Home" "D:\\Home\\Bob" == "D:\\Home\\Bob"
> Windows: makeRelative "C:\\Home" "C:Home\\Bob" == "C:Home\\Bob"
> Windows: makeRelative "/Home" "/home/bob" == "bob"
> Posix: makeRelative "/Home" "/home/bob" == "/home/bob"
> Posix: makeRelative "/home/" "/home/bob/foo/bar" == "bob/foo/bar"
> Posix: makeRelative "/fred" "bob" == "bob"
> Posix: makeRelative "/file/test" "/file/test/fred" == "fred"
> Posix: makeRelative "/file/test" "/file/test/fred/" == "fred/"
> Posix: makeRelative "some/path" "some/path/a/b/c" == "a/b/c"
The elemIndices function extends elemIndex, by returning the indices of all elements equal to the query element, in ascending order.
Show more results