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*
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started