Question: IN LISP 1. Code the function (repeat atm N) which constructs a new list with atm repeated N times. Example > (repeat 'A 5 2.

IN LISP

IN LISP 1. Code the function (repeat atm N) which constructs a

new list with atm repeated N times. Example > (repeat 'A 5

2. Code the function (duplicate lis) which duplicates each atom at the

1. Code the function (repeat atm N) which constructs a new list with atm repeated N times. Example > (repeat 'A 5 2. Code the function (duplicate lis) which duplicates each atom at the top level of a list. If there is a list at the top-level, that list isn't duplicated, but it is included in the result. Hint: You may have to use either CONS twice or REPEAT Examples (duplicate (A B C)) > (duplicate '(GUM (HAS BEEN) CHEWED)) (GUM GUM (HAS BEEN) CHEWED CHEWED) 3. 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) (duplicateN' (A B C) 3) > (duplicateN GUM (HAS BEEN) CHEWED) 2) (A A B Bc C) (GUM GUM (HAS BEEN) CHEWED CHEWED) 4. Code the function duplicateDeep which duplicates each atom at any level. If there is a list at any level, each atom in that list is duplicated. Hint: APPEND could be useful oeue wtnle D could be usefut

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!