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

  Questions on ferris wheel

Prepare a Flexible Budget Gator Divers is a company that provides diving services such as underwater ship repairs to clients in the Tampa Bay area.

  Logistic map

This assignment has two question related to maths. Questions are related to bifurcation cascade and logistic map.

  Finding the probability of cards

This assignment has questions related to probabiltiy.

  Systems of ode

Find all the xed points, and study their stability and Draw the phase portrait of the system, as well as the graphs of the solutions in all relevant cases.

  Derive the boolean expression

Derive the Boolean Expression and construct the switching circuit for the truth table stated

  System of equations

Evaluate which equations are under-identified, just-identified, and over-identified.

  Linear programming problem

Linear programming problem consisting of only two constraints with one objective function.

  Find the natural domain

Find the natural domain of the given functions.

  Introduction to numerical methods

Compute the coecients of the polynomials using the term recurrence relation.

  Chart of the topological manifold

De?nition of smoothness of functions on a smooth manifold is chart independent and hence geometric.

  Mathematics in computing

Questions related on mathematics in computing.

  Complex problems

Complex problems

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