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