tails

The tails function returns all final segments of the argument, longest first.

Laziness

Note that tails has the following strictness property: tails _|_ = _|_ : _|_
>>> tails undefined
[*** Exception: Prelude.undefined
>>> drop 1 (tails [undefined, 1, 2])
[[1, 2], [2], []]

Examples

>>> tails "abc"
["abc","bc","c",""]
>>> tails [1, 2, 3]
[[1,2,3],[2,3],[3],[]]
>>> tails []
[[]]
The tails function takes a stream xs and returns all the suffixes of xs, starting with the longest. The result is NonEmpty because the result always contains the empty list as the last element.
tails [1,2,3] == [1,2,3] :| [[2,3], [3], []]
tails [1] == [1] :| [[]]
tails [] == [] :| []
O(n) Returns all final segments of the given ByteString, longest first.
O(n) Return all final segments of the given Text, longest first.
Returns a sequence of all suffixes of this sequence, longest first. For example,
tails (fromList "abc") = fromList [fromList "abc", fromList "bc", fromList "c", fromList ""]
Evaluating the <math>th suffix takes <math>, but evaluating every suffix in the sequence takes <math> due to sharing.
This function is lazier than the one suggested in the Haskell 98 report. It is tails undefined = ([] : undefined) : undefined, in contrast to Data.List.tails undefined = undefined.
The tails function returns all final segments of the argument, longest first. For example,
>>> tails "abc"
["abc","bc","c",""]
Note that tails has the following strictness property: tails _|_ = _|_ : _|_
O(n) Return all final segments of the given ByteString, longest first.
The tails function takes a stream xs and returns all the suffixes of xs.
Returns all the final segments of seq with the longest first.
> tails [1,2]
[[1,2],[2],[]]
> tails []
[[]]
All final segnemts, longest first
O(n^2) Return all final segments of the given JSString, longest first.
Returns the list of all suffixes of the argument, mempty last.
O(n) Return all final segments of the given Vector, longest first.
The tails function takes a stream xs and returns all the suffixes of xs.
Generate all suffixes of an infinite list.
Returns a sequence of all non-empty suffixes of this sequence, longest first. For example,
tails (fromList (1:|[2,3])) = fromList (fromList (1:|[2,3]) :| [fromList (2:|[3]), fromList (3:|[])])
Evaluating the <math>th suffix takes <math>, but evaluating every suffix in the sequence takes <math> due to sharing.
Select the tail elements along the supplied dimensions.
>>> pretty $ tails [0,2] a
[[[13,14,15],
[17,18,19],
[21,22,23]]]
Select the tail elements along the supplied dimensions.
>>> pretty $ tails (Dims @[0,2]) a
[[[13,14,15],
[17,18,19],
[21,22,23]]]
Given a stream, produce an infinite list of streams dropping an increasing number of elements of the given stream. For example, for a given stream s, the expression tails s is equal to [ drop 0 s, drop 1 s, drop 2 s, ...].
O(n). Returns all final segments of the argument, shortest first.
>>> tails $ slist "abc"
Slist {sList = [Slist {sList = "abc", sSize = Size 3},Slist {sList = "bc", sSize = Size 2},Slist {sList = "c", sSize = Size 1},Slist {sList = "", sSize = Size 0}], sSize = Size 4}

>>> tails mempty
Slist {sList = [Slist {sList = [], sSize = Size 0}], sSize = Size 1}