Question: Write and fully demonstrate a function in Scheme language named super-duper, with this interface: (super-duper source count) The function returns a copy of the list

Write and fully demonstrate a function in "Scheme language" named super-duper, with this interface:

(super-duper source count)

The function returns a copy of the list source, with every element duplicated count times. If source is an atom, it is immediately returned, without duplication.

For example:

(super-duper 123 1)

123

(super-duper 123 2)

123

(super-duper () 1)

()

(super-duper () 2)

()

(super-duper (x) 1)

(x)

(super-duper (x) 2)

(x x)

(super-duper (x y) 1)

(x y)

(super-duper (x y) 2)

(x x y y)

(super-duper ((a b) y) 3)

((a a a b b b) (a a a b b b) (a a a b b b) y y y)

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!