isSuffixOf -package:rio

The isSuffixOf function takes two lists and returns True iff the first list is a suffix of the second.

Examples

>>> "ld!" `isSuffixOf` "Hello World!"
True
>>> "World" `isSuffixOf` "Hello World!"
False
The second list must be finite; however the first list may be infinite:
>>> [0..] `isSuffixOf` [0..99]
False
>>> [0..99] `isSuffixOf` [0..]
* Hangs forever *
O(n) The isSuffixOf function takes two ByteStrings and returns True iff the first is a suffix of the second. The following holds:
isSuffixOf x y == reverse x `isPrefixOf` reverse y
However, the real implementation uses memcmp to compare the end of the string only, with no reverse required..
O(n) The isSuffixOf function takes two ByteStrings and returns True iff the first is a suffix of the second. The following holds:
isSuffixOf x y == reverse x `isPrefixOf` reverse y
O(n) The isSuffixOf function takes two ShortByteStrings and returns True iff the first is a suffix of the second. The following holds:
isSuffixOf x y == reverse x `isPrefixOf` reverse y
O(n) The isSuffixOf function takes two Texts and returns True if and only if the first is a suffix of the second.
isSuffixOf takes two sequences and returns True if the first sequence is a suffix of the second.
The isSuffixOf function takes two lists and returns True iff the first list is a suffix of the second. The second list must be finite.
>>> "ld!" `isSuffixOf` "Hello World!"
True
>>> "World" `isSuffixOf` "Hello World!"
False
Tests whether the first ShortText is a suffix of the second ShortText
>>> isSuffixOf "ef" "abcdef"
True
>>> isPrefixOf "df" "abcdef"
False
isSuffixOf "" t == True
isSuffixOf t t == True
Is the first argument a suffix of the second argument?
True when the first list is at the beginning of the second.
O(n) The isSuffixOf function takes two JSStrings and returns True iff the first is a suffix of the second.
Returns True if the first stream is a suffix of the second. A stream is considered a suffix of itself.
>>> Stream.isSuffixOf (Stream.fromList "hello") (Stream.fromList "hello" :: SerialT IO Char)
True
Space: O(n), buffers entire input stream and the suffix. Pre-release Suboptimal - Help wanted.
The isSuffixOf function takes two lists and returns True iff the first list is a suffix of the second.
>>> "ld!" `isSuffixOf` "Hello World!"
True

>>> "World" `isSuffixOf` "Hello World!"
False
The second list must be finite; however the first list may be infinite:
>>> [0..] `isSuffixOf` [0..99]
False

>>> [0..99] `isSuffixOf` [0..]
* Hangs forever *
O(n) The isSuffixOf function takes two Vectors and returns True iff the first is a suffix of the second. The following holds:
isSuffixOf x y == reverse x `isPrefixOf` reverse y
O(n) The isSuffixOf function takes two OsStrings and returns True iff the first is a suffix of the second. The following holds:
isSuffixOf x y == reverse x `isPrefixOf` reverse y
O(n) The isSuffixOf function takes two OsStrings and returns True iff the first is a suffix of the second. The following holds:
isSuffixOf x y == reverse x `isPrefixOf` reverse y
O(n) The isSuffixOf function takes two OsStrings and returns True iff the first is a suffix of the second. The following holds:
isSuffixOf x y == reverse x `isPrefixOf` reverse y
Returns True if the first stream is a suffix of the second. A stream is considered a suffix of itself.
>>> Stream.isSuffixOf (Stream.fromList "hello") (Stream.fromList "hello" :: Stream IO Char)
True
Space: O(n), buffers entire input stream and the suffix. Pre-release Suboptimal - Help wanted.
Check whether the first string is a suffix of the second string.
Takes two collections and returns True iff the first collection is a suffix of the second.
Takes two collections and returns True iff the first collection is a suffix of the second.
isSuffixOf suf l. Is suf a suffix of l?
>>> prove $ \(l1 :: SList Word16) l2 -> l2 `isSuffixOf` (l1 ++ l2)
Q.E.D.

>>> prove $ \(l1 :: SList Word16) l2 -> l1 `isSuffixOf` l2 .=> subList l2 (length l2 - length l1) (length l1) .== l1
Q.E.D.

>>> prove $ \(s1 :: SString) s2 -> s2 `isSuffixOf` (s1 ++ s2)
Q.E.D.

>>> prove $ \(s1 :: SString) s2 -> s1 `isSuffixOf` s2 .=> subList s2 (length s2 - length s1) (length s1) .== s1
Q.E.D.