5.2 List Handling Functions
TBoS p.63-74 SD
The following function tests if one list is a prefix of another.
(0-) (define prefix?
[] _ -> true
[X | Y] [X | Z] -> (prefix? Y Z)
_ _ -> false)
(fn prefix?)
(1-) (prefix? [1 2 3] [1 2 3 4 5 6])
true
(2-) (prefix? [] 8)
true |
|