Question: Using Scheme, write a simple pattern-matching program. Define a sublist function that takes two lists as arguments. It will return true (T) and all sublist
Using Scheme, write a simple pattern-matching program. Define a sublist function that takes two lists as arguments. It will return true (T) and all sublist indices if the first list appears as a contiguous sub list somewhere within the second list, and false (f) otherwise. For example:
(sublist '(c d e) '(a b c d e c d e f g)) ==> T 2 5
(sublist '(a c e) '(a b c d e f g)) ==> F
(sublist '(f) '(a b c d e f g)) ==> T 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
