This assignment asks you to write recursive procedures in Racket. The primary goal of this assignment is to gain experience with recursion and Racket lists. For this assignment:
Download the file homework04.rkt and use it as a template for your submission. Please keep and use the name homework04.rkt.
As before, this file includes a require clause that enables you to use Rackunit to test your solutions [ example code ]. This file also includes a provide clause that exports your five public functions. This enables me to load your module and test the functions using my own Rackunit tests.
> (symbol* 's 2) '(s s) > (symbol* 'ew 5) '(ew ew ew ew ew) > (symbol* 'carolina 0) '()
> (reject positive? '(1 -1 2 -2 3 -3 4 -4 -5)) '(-1 -2 -3 -4 -5) > (reject odd? '(1 -1 2 -2 3 -3 4 -4 -5)) '(2 -2 4 -4) > (reject divisible-by-10 ; helpers in your (sequence -1 11)) ; template file '(-1 1 2 3 4 5 6 7 8 9 11) > (reject pair? '(a (b c) (d e) f)) '(a f)
> (zip '(a b c d e) '(1 2 3 4 5)) '((a . 1) (b . 2) (c . 3) (d . 4) (e . 5)) > (zip '(foo bar baz bif) (sequence 1 4)) '((foo . 1) (bar . 2) (baz . 3) (bif . 4)) > (define 1-to-5 (sequence 1 5)) > (zip 1-to-5 (map square 1-to-5)) ; in template file '((1 . 1) (2 . 4) (3 . 9) (4 . 16) (5 . 25)You may assume that lst1 and lst2 have the same length. You'll receive an extra credit point if your function handles lists of unequal lengths gracefully.
> (positions-of 'a '(a b a c d a e f g a h i j k)) '(0 2 5 9) > (positions-of 'a '(b c d e f g h i j k)) '()Hint: You will need to make positions-of an interface procedure that calls a helper function with a second argument.
> (every? #t) #t > (every? #f) #f > (every? #f #f #f #t #f #f) #f > (apply every? (map even? (sequence 1 30))) #f > (apply every? (map even? (reject odd? (sequence 1 30)))) #t > (every?) #tHint: This may be easier if you make every? an interface procedure that calls a helper function to do the real work with a single list argument.
By the due time and date, submit the following files:
Be sure that your submission follows the submission requirements. Use Save Interactions As Text... to create the file of interactions that you submit, and change the file extension to txt.