Develop a racket program

Assignment Help Mathematics
Reference no: EM131033106

Develop a Racket program that provides definitions for the following functions

1. A function that returns the greatest common divisor of two integers

2. A function named occurrences that takes as parameters two arguments, a and b. If a is not a list then the function should return #f. Otherwise it should return the number of times b is found in the list a. For example, if a is (3 4 2 53 3 5 4) and b is 3 the function should return 2

3. A function called allDiff? that takes as parameters two lists. The function returns #t if none of the elements in the first list can be found in the second

4. A tail recursive function that takes as a parameter a list and returns the average of all the number elements that exist in the list (if none are found it should return #f)

5. A function named divisorsLs that takes as a parameter an integer and returns a list of its divisors.

6. A higher-order function called map2. The function takes as parameter a function f and two lists ls1 and ls2. It returns a list that corresponds to the application of the function to each pair of the parameter lists elements. For example, assuming the pow function takes two parameters and raises the first to the power of the second [ (pow 2 3) -> 8 ], then

(map2   pow (2  3  1  5) (4  2  0  1))

would return

(16   9   1   5)

7. Assume that a two-dimensional point is presented as a dotted pair where the car value is the x- coordinate and the cdr value the y coordinate. Furthermore, assume that a line is defined by a pair of two points. Define a function that takes as parameter two lines and returns #t if they intersect

8. A collection of line segments can be represented by a list of dotted pairs, each one corresponding to a point on a Cartesian plane. For example, the list

((3 . 6) ( 7 . 8) ( 10 . -2) (11 . -3) ( 18 . 1) (15 . 4) (25 . 9) (26 . -8))

corresponds to the line segments shown in Figure 1. Create a function that takes as a parameter a line segment and returns the number of times the segment crosses the horizontal axis. In the provided example, the function should return 3.

2253_Figure.png

Reference no: EM131033106

Questions Cloud

Explain how skill can be applied in two of following areas : Identify one skill you have acquired or improved upon during the first two weeks of this course. Explain how this skill can be applied in two of the following areas: your personal, academic, and/or professional life.
Determine the masses of dry air and the water vapour : Determine the masses of dry air and the water vapor contained in a 240-m3 room at 98 kPa, 23°C, and 50 percent relative humidity.
Whose glasses are more likely to be fogged : Andy and Wendy both wear glasses. On a cold winter day, Andy comes from the cold outside and enters the warm house while Wendy leaves the house and goes outside.
How children may be affecte by class and by peoples attitude : How children may be affected by class and by people's attitudes and beliefs related to class? How the information presented in your text might have a negative effect on teachers' perceptions of children and their families?
Develop a racket program : Develop a Racket program that provides definitions for the following functions. A function that returns the greatest common divisor of two integers
Determine the dew-point temperature : The air in a room has a dry-bulb temperature of 80°F and a wet-bulb temperature of 65°F.
Determine whether the glasses will become fogged : After a long walk in the 8°C outdoors, a person wearing glasses enters a room at 25°C and 40 percent relative humidity.
Idea of racism without racists : In what ways does the idea of "racism without racists" connect to other historical transformations we've studied in this class?
How can you explain this sweating : In summer, the outer surface of a glass filled with iced water frequently "sweats."

Reviews

Write a Review

Mathematics Questions & Answers

  Geometry-trapezoids

Determine whether it is possible to find a circumscribable, isoceles "true" trapezoid (in which the parallel sides are not congruent) that has each of the following properties. Justify the answer

  What is the mean monthly mortgage paid by all homeowners

Suppose that the monthly mortgage payments of all homeowners have a normal distribution. What is the mean monthly mortgage paid by all homeowners?

  How many serving of each food should the dietician provide

Each glass of 2% milk has 9 grams of protein, 13 grams of carbohydrates, and 300 mg of calcium. How many serving of each food should the dietician provide for the patient?

  Enguun earns 17 per hour tutoring student-athletes at

enguun earns 17 per hour tutoring student-athletes at brooklyn university. if enguun tutored for 12 hours this month

  Find the length of the wire

The figure below show a telephone wire hanging between two poles at x = - b and x = b. It takes the shape of a catenary with equation y = c + a Find the length of the wire.

  There is a very famous distribution that describes

There is a very famous distribution that describes the frequency of the number of times a number comes up in a series of dice rolls, what is its name?

  Find speed of current and speed of boat in still water

A man rows a boat 420 feet upstream against a constant current in 14 minutes. He then rows 350 feet downstream (with the same current) in 7 minutes. Find the speed of the current and the equivalent rate at which he can row in still water. Find spe..

  How many hamburgers were sold on friday

On Friday, a local hamburger shop sold a combined total 444 of hamburgers and cheeseburgers. The number of cheeseburgers sold was two times the number of hamburgers sold. How many hamburgers were sold on Friday?

  Draw a venn diagram of johns section

Draw a Venn diagram of John's section of the electric company using T = those who cut trees, P = those who climb poles, and W = those who splice wire and label each region with the correct number of employees.

  At which water is being pumped into the tank

The tank has height 7 m and the diameter at the top is 6 m. If the water level is rising at a rate of 18 cm/min when the height of the water is 2.5 m, find the rate at which water is being pumped into the tank.

  Find probability what percent are between 29 and 42 minutes

Among U.S. cities with a population of more than 250,000 the mean one-way commute to work is 24.3 minutes. The longest one-way travel time is New York City, where the mean time is 37.9 minutes.

  Evaluate the dimensions of the rectangle

Evaluate the dimensions of the rectangle of maximum area that can be inscribed in a ellipse

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd