Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Coding must be done in the Lisp Language! 3. Write a function in the manner (defun split (sent punc).) for splitting the given list, 'sent',

image text in transcribedimage text in transcribed

Coding must be done in the Lisp Language!

3. Write a function in the manner (defun split (sent punc).) for splitting the given list, 'sent', into two lists, one consisting of the elements before the first occurrence of the atom 'punc' (as a top-level list element), and the other consisting of the elements after the first occurrence of 'punc', preserving the ordering of the elements. If 'sent' is not a list or 'punc' is not an atom, print an error message and return NIL. If 'sent and 'punc' are of the required type but 'sent' does not contain a top-level occurrence of 'punc, return 'sent' unchanged. For example, (split '(Hi there . How are you ?) .) --> ((HI THERE) (HOW ARE YOU?)) (spt it | (Hi, the re \. How are you ?) '?) ==> ((HI THERE \. HOW ARE YOU ) ( )) (split ((Hi there) ( (How are you?))'(.)) > Error: The 2nd arg of 'split', (1.). is not an atom NIL (split ' ((Hi there) (\') (How are you? ) ) '\.) ==> ((HI THERE) (\.) (HOW ARE YOU?)) 3. Write a function in the manner (defun split (sent punc).) for splitting the given list, 'sent', into two lists, one consisting of the elements before the first occurrence of the atom 'punc' (as a top-level list element), and the other consisting of the elements after the first occurrence of 'punc', preserving the ordering of the elements. If 'sent' is not a list or 'punc' is not an atom, print an error message and return NIL. If 'sent and 'punc' are of the required type but 'sent' does not contain a top-level occurrence of 'punc, return 'sent' unchanged. For example, (split '(Hi there . How are you ?) .) --> ((HI THERE) (HOW ARE YOU?)) (spt it | (Hi, the re \. How are you ?) '?) ==> ((HI THERE \. HOW ARE YOU ) ( )) (split ((Hi there) ( (How are you?))'(.)) > Error: The 2nd arg of 'split', (1.). is not an atom NIL (split ' ((Hi there) (\') (How are you? ) ) '\.) ==> ((HI THERE) (\.) (HOW ARE YOU?))

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

=+4 What are non-union workers representations?

Answered: 1 week ago