Question: Please use Racket Programming Languages We shall create a new list of Os and 1s out of an old list of Os and 1s by

Please use Racket Programming Languages

Please use Racket Programming Languages We shall create a new list of

We shall create a new list of Os and 1s out of an old list of Os and 1s by applying the following rewrite rules: (i) where the old list had a 0, the new list will have a 1. (ii) where the old list had a 1, the new list will have a 0 followed by a 1. We shall begin my making the oth list simply be '(0) This means the next list will be '(1) by following rule-i This means that after that one, the new list #2 will be '(01) by following rule-ii List #3 would be ( 1 0 1). The leftmost 1 in list#3 came from the 0 in list#2, and then the 0 1 after it comes from the 1 in list#2 Further examples can be seen in the unit tests. # #lang racket (require rackunit) (require rackunit/text-ui) ; PART 1A. Implement the function binlist according to the following specifications ; input contract: n is a nonnegative integer ; output contract: (binlist n) is the nth list as generated from the rewrite rules described above. ; Example: (binList 4) would be the list (0 1 1 0 1), since the 101 from list#3 would turn into 1->01, 0->1, 1->01 (define (binList n) 0; put your code here We shall create a new list of Os and 1s out of an old list of Os and 1s by applying the following rewrite rules: (i) where the old list had a 0, the new list will have a 1. (ii) where the old list had a 1, the new list will have a 0 followed by a 1. We shall begin my making the oth list simply be '(0) This means the next list will be '(1) by following rule-i This means that after that one, the new list #2 will be '(01) by following rule-ii List #3 would be ( 1 0 1). The leftmost 1 in list#3 came from the 0 in list#2, and then the 0 1 after it comes from the 1 in list#2 Further examples can be seen in the unit tests. # #lang racket (require rackunit) (require rackunit/text-ui) ; PART 1A. Implement the function binlist according to the following specifications ; input contract: n is a nonnegative integer ; output contract: (binlist n) is the nth list as generated from the rewrite rules described above. ; Example: (binList 4) would be the list (0 1 1 0 1), since the 101 from list#3 would turn into 1->01, 0->1, 1->01 (define (binList n) 0; put your code here

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!