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

  How many cartons were left over

Juan's first-grade class received 82 half-pint cartons of milk to distribute evenly to his 22 students. How many cartons were left over?

  A man has a rectangular garden one length of the garden

a man has a rectangular garden. one length of the garden lies along a patio wall. however the rest of the garden is

  What is the volume of the box

if a rectangular prism has a side of 69 square inches and one with 252 square inches and another side with 168 square inches then what is the volume of the box?

  What is the transition matrix

A. What are the coordinate vectors of V and W wrt to the basis T B. What is the transition matrix P from T to S basis? C. What are the coordinate vectors of V and W wrt to S (Using P from T to S basis) D. Directly solve for the coordinate vectors of ..

  Find the gradient field of f

find the gradient field of f where f(x,y)= xy-2x. skecht some lever of a curve.

  Calculate the f-statistic to two decimal places

The BETWEEN groups sum of squares was calculated to be 1,892.6, and the WITHIN groups sum of squares was calculated to be 14,482.9. (NOTE: These are not the mean sum of squares) Calculate the F-statistic to two decimal places.

  Integer programming model

The Decision Sciences department head at a university will be scheduling faculty to teach courses during the coming fall semester.

  Thousand pounds for t between 0 and 00006 seconds find

the impulse-momentum equation states the relationship between a force ft applied to an object of mass m and the

  Use differentials to estimate the maximum possible error

The edge of a cube was found to be 80 cm with a possible error of 0.3 cm. Use differentials to estimate the maximum possible error in the calculated volume of the cube.

  Question use inverse trigonometric functions to find a

question use inverse trigonometric functions to find a solution to the equation cosx0.6 in the interval 0 leq x leq

  Define there is a liquid motion due to a doublet of strength

there is a liquid motion due to a doublet of strength μ at the point (0,3α) with its axis along the Y axis.find the velocity potential

  What is the exact limit of the sequence defined

What is the exact limit of the sequence defined in c)? Consider the following recursively defined sequence: a1 = 0.3; an+1 = √(an + 1) for n > 1.

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