Using lisp write a simple pattern matching program.

Using Lisp 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
mastdeals
Asked Nov 08, 2013

TIP: If it's not your answer to this question, please click "Leave a Comment" button under the question to communicate with the question owner.

Categories