Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer the following questions in scheme programming language 1.replaceallwith takes an atom and two lists of atoms. Each occurrence if the atom in the

Please answer the following questions in scheme programming language

1.replaceallwith takes an atom and two lists of atoms. Each occurrence if the atom in the first list is replaced by one of the atoms of the second list, in order. So, the first occurrence of the atom in the first list is replaced by the first atom of the second list, the second occurrence is replaced by the second atom of the second list, and so on. If there are not enough atoms in the second list, the rest of the first list is unchanged.

> (replacewith 'x '(a b x c d x e x x f x) '(1 2 3 4)) '(a b 1 c d 2 e 3 4 f x)

2.everyother* takes a list that may contain sublists. The function returns a list that contains every other element of the input list, and if the element is also a list, then every other element of that sublist is included in the returned list, and so on for each sublists it contains.

> (everyother* '(a (b c (d)) ((e f g) h (((i)) () (j k)) (l m n)))) '(a ((e g) (((i)) (j))))

3.

myequal takes two lists that may contain sublists and returns #t if they have exactly the same atoms and sublists in the same order.

> (myequal '(a b (c ((d) e f) g)) '(a b (c ((d) e f) g))) #t > (myequal '(a b (c ((d) e f) g)) '(a b (c ((e) e f) g))) #f > (myequal '(a b (c ((d) e f) g)) '(a b (c (d e f) g))) #f

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

Define work breakdown structure. How is it used?

Answered: 1 week ago