Question: Create a Basic Functions using Scheme Language, Shift-left and shift-right Write functions shiftLeft and shiftRight that take a single argument that is assumed to be

Create a Basic Functions using Scheme Language,

Shift-left and shift-right

Write functions shiftLeft and shiftRight that take a single argument that is assumed to be a list, possibly empty. shiftLeft returns a new list like its argument but with first element moved to the end of the list. shiftRight returns a new list with the last element moved to the front.

Here are some examples:

Create a Basic Functions using Scheme Language, Shift-left and shift-right Write functions

hint: consider using the reversefunction in scheme, which takes a list and returns the same list in reverse order

> (shift-left"(1 2 3)) (2 3 1) > (shift-left "(1)) > (shift-left 'O > (shift-left (shift-left '(12 3))) (3 1 2) > (shift-right '(1 2 3)) (3 1 2) > (shift-right (1)) > (shift-right "O > (shift-right (shift-right "Ca b c))) (b c a)

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!