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

  Question a pharmacy claims that the average medication

question a pharmacy claims that the average medication costs 32 but it could differ as much as 8. write and solve an

  What rate is the area enclosed by the ripple

A stone dropped in a still pond creates a circular ripple whose radius increases at a constant rate of 3 ft/s. At what rate is the area enclosed by the ripple increasing 8 s after the stone strikes the pond?

  Proof by contradiction

Assume that n is a positive integer. Use the proof by contradiction method to prove: If 7n + 4 is an even integer then n is an even integer.

  Describe how a domestic fast food chain with plans

Describe how a domestic fast food chain with plans for expanding into China would be able to use a forecasting model.

  Convergence and divergence find an infinite series of the

convergence and divergence find an infinite series of the given absolute function by using the fact give also estimate

  Do the data indicate a significant difference in average

Do the data indicate a significant difference in average off-schedule lime? Use a 5 percent level of significance.

  Math problem-ending balance-interest and pay out

If I have a 10,000 death benefit at work that is left on deposit for 7 years at an annual interest rate of 5%. The balance after 7 years is what? and then is going to be paid out in 120 equal payments.

  Linear differential operator defined on the vector space

Let D be the linear differential operator defined on the vector space V of infinitely differentiable functions f: R-->R by D(f)=F

  How far will driver travel a speed of 61 mph for 6 hr

a driver who has a speed of r mph for t hr will travel a distance of d mi given by d = rt mi. How far will driver travel a speed of 61 mph for 6 hr?

  Post a behavioral research situation which could use

post a behavioral research situation that could use a pearson coefficient research study and a chi square research

  Gaussian distribution

Problem 10: Gaussian distribution A binary transmission system transmits a signal X(

  Linear system of two unknowns

Show that the equation AX = B represents a linear system of two equations in two unknowns Solve the system and substitute into the matrix equation to check your results

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