Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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* image text in transcribed image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

T Sql Fundamentals

Authors: Itzik Ben Gan

4th Edition

0138102104, 978-0138102104

More Books

Students also viewed these Databases questions