Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In LISP, Code the function ( duplicateN lis N ) which duplicates each atom at the top level N times. If there is a list

In LISP, Code the function (duplicateN lis N) which duplicates each atom at the top level N times. If there is a list at the top-level, it isn't duplicated, but it is included in the result.

Hint: APPEND could be useful.

Examples:

> (duplicateN ' (A B C) 2)

(A A B B C C)

> (duplicateN ' (A B C) 3)

(A A A B B B C C C)

> (duplicateN ' (GUM (HAS BEEN) CHEWED) 2)

(GUM GUM (HAS BEEN) CHEWED CHEWED)

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 For Mere Mortals

Authors: Michael J Hernandez

4th Edition

978-0136788041

More Books

Students also viewed these Databases questions

Question

=+3. Which factors do influence the procurement management?

Answered: 1 week ago

Question

1. Diagnose and solve a transfer of training problem.

Answered: 1 week ago