Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Common LISP , write a recursive function (REPLICATE L NLIST) which takes a list L and a list NLIST of integers (all of which

Using Common LISP, write a recursive function (REPLICATE L NLIST) which takes a list L and a list NLIST of integers (all of which can be assumed to be >= 0) and which uses NLIST as a "template" to produce a new list in whch each element of L is replicated the number of times specified in NLIST.

For example:

(REPLICATE '(A B C D E) '(1 0 4 3 2)) should return (A C C C C D D D E E),

(REPLICATE '(W X Y Z X Q W) '(3 4 0 1) should return (W W W X X X X Z),

(REPLICATE '(1 2 3 1) '(1 2 3 4 5 6)) should return (1 2 2 3 3 3 1 1 1 1),

(REPLICATE '(X W X E D R) nil) should return nil,

(REPLICATE nil '(1 0 0 3 2)) should return nil.

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

Database Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions

Question

3. Show your interest in your students as individuals.

Answered: 1 week ago

Question

4. Who should be invited to attend?

Answered: 1 week ago

Question

7. How will you encourage her to report back on the findings?

Answered: 1 week ago