Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Program in RACKET 1. divisible-by-x? Define your own Racket function that takes an integer as an argument and returns a function that indicates whether its

Program in RACKET

image text in transcribed

image text in transcribed

1. divisible-by-x? Define your own Racket function that takes an integer as an argument and returns a function that indicates whether its integer argument is evenly divisible by the first. You do not have to perform data type checking on the input. You may assume that the input is an integer. Input: An integer Output: A function. Example: > ((divisible-by-x? 3) 12) #t > ((divisible-by-x? 7) 20) #f > (define div-by-5 (divisible-by-x? 5)) > (div-by-5 15) #t 5. classify Define a function that takes a procedure that executes a Boolean test on an atomic value and a list of elements as arguments. It should returns a list containing exactly two sublists. You may not use the built-in filter function as a helper function. You may define your own helper functions. Your implementation must be recursive. Input: Two arguments... (1) a function that takes a single element and returns a Boolean, and (2) a list of elements whose element types are compatible with the single element from the first argument. Output: A new list with two sublists. The first sublist contains the elements from the original list that return true (#t) and the second sublist contains the elements from the original list that return false (#). Example: > (classify even? '(7 2 3 5 8)) '((2 8) (7 3 5)) > (classify integer? '(3.0 -5.2 8 16 99.7)) '((3.0 8 16) (-5.2 99.7)) > (classify real? '()) (0)

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions

Question

Why is the critical path an important monitoring tool

Answered: 1 week ago

Question

Describe the role of HR in succession management.

Answered: 1 week ago