isprefixof -package:ListLike

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

Examples

>>> "Hello" `isPrefixOf` "Hello World!"
True
>>> "Hello" `isPrefixOf` "Wello Horld!"
False
For the result to be True, the first list must be finite; False, however, results from any mismatch:
>>> [0..] `isPrefixOf` [1..]
False
>>> [0..] `isPrefixOf` [0..99]
False
>>> [0..99] `isPrefixOf` [0..]
True
>>> [0..] `isPrefixOf` [0..]
* Hangs forever *
isPrefixOf shortcuts when the first argument is empty:
>>> isPrefixOf [] undefined
True
The isPrefixOf function returns True if the first argument is a prefix of the second.
O(n) The isPrefixOf function takes two ByteStrings and returns True if the first is a prefix of the second.
O(n) The isPrefixOf function takes two ByteStrings and returns True iff the first is a prefix of the second.
O(n) The isPrefixOf function takes two ShortByteStrings and returns True iff the first is a prefix of the second.
O(n) The isPrefixOf function takes two Texts and returns True if and only if the first is a prefix of the second.
O(n) The isPrefixOf function takes two Streams and returns True if and only if the first is a prefix of the second. Properties
isPrefixOf (stream t1) (stream t2) = isPrefixOf t1 t2