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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!