Question: Please answer the following question in racket language. The template is provided below. The answer should strictly follow the template. *Solutions are expected to only

Please answer the following question in racket language. The template is provided below. The answer should strictly follow the template. *Solutions are expected to only use functions from the standard library that was given* Please answer the following question in racket language. The template is provided below. The answer should strictly follow the template. *Solutions are expected to

Solution Template: Use this for the solution

#lang racket (require rackunit) (provide (all-defined-out))

;; Exercise 3.a: Generic find ;; Solution has 7 lines. (Write your code here) (define (find pred l) 'todo)

;; Exercise 3.b: Member using find ;; Solution has 3 lines. (define (member x l) 'todo) (Write your code here)

;; Exercise 3.c: index-of using find ;; Solution has 4 lines. (define (index-of l x) 'todo) (Write your code here) Let me know if you need any more info . Thanks

(b) (25 points) Implement funetion sember in termas of fimetion find. Funetion sember element x and a list l and returns #t if the element x is in list 1, otherwise it returns #f (check-true (member 20 (list 10 20 30))) (check-false (member 40 (list 10 20 30))) (c) (2.5 points) Implement function index-of in terms of function find. Function index-of takes a list 1 and an element x and returns the index of the first occurrence of element x in list 1, otherwise it returns #f (check-equal? 1 (index-of (list 10 20 30) 20)) (check-equal? #f (index-of (list 10 20 30) 40)) (b) (25 points) Implement funetion sember in termas of fimetion find. Funetion sember element x and a list l and returns #t if the element x is in list 1, otherwise it returns #f (check-true (member 20 (list 10 20 30))) (check-false (member 40 (list 10 20 30))) (c) (2.5 points) Implement function index-of in terms of function find. Function index-of takes a list 1 and an element x and returns the index of the first occurrence of element x in list 1, otherwise it returns #f (check-equal? 1 (index-of (list 10 20 30) 20)) (check-equal? #f (index-of (list 10 20 30) 40))

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!