Reference no: EM13335234
Question 1
Write a function that produces a stream of positive prime numbers . Use that stream to create a list of the product of all pairs of consecutive prime numbers up to a given value.
For example, if we want the answer for prime numbers up to 20, the prime numbers are:
2, 3, 5, 7, 11, 13, 17, 19
The output list would be:
‘(6, 15, 35, 77, 143, 221, 323)
Question 2
Write a function called stream-map :
(define (stream-map proc . argstreams)
<your code here>)
The proc argument is the procedure to apply to one or more streams, while argstreams is a list of a variable number of streams to be used with proc.
Now write a function that uses stream-map to produce the sum of two streams element by element for the first x elements . Be sure to test with several different types of streams (for example, you could sum together the odd and even numbers between 1 and x).
Question 3
Using Prolog, establish a database of facts and rules for the following predicates:
father(X,Y) /* X is the father of Y */
mother(X,Y) /* X is the mother of Y */
male(X) /* X is male */
female(X) /* X is female */
parent(X, Y) /* X is the parent of Y */
difference(X,Y) /* X and Y are different */
Write Prolog clauses to define the following relationships:
is_mother(X) /* X is a mother */
is_father(X) /* X is a father */
aunt(X, Y) /* X is an aunt of Y */
uncle(X, Y) /* X is an uncle of Y */
sister_of(X,Y) /* X is a sister of Y */
grandfather_of(X, Y) /* X is a grandfather of Y */
grandmother_of(X, Y) /* X is a grandmother of Y */
grandchild(X,Y) /* X is a grandchild of Y */
sibling(X,Y) /* X is a sibling of Y, i.e they have the same parents */
half_sibling(X,Y) /*they have same mother but different fathers or
same father, different mothers */
related(X,Y) /* X is related to Y */
ancestor(X, Y) /* X is an ancestor of Y */
descendant(X,Y) /* X is a descendant of Y */
Write function that produces a stream prime numbers
: Write a function that produces a stream of positive prime numbers . Use that stream to create a list of the product of all pairs of consecutive prime numbers up to a given value.
|
Should we try and completely eliminate unemployment
: When the U.S. economy is at full employment, why isn’t the unemployment rate at zero percent? Should we try and completely eliminate unemployment?
|
What should be average beta of new stocks added to portfolio
: Assume that the risk free rate is 4.5% and that the market risk premium is 5.5%. The manager expects to receive an additional $5,000,000 in funds soon.
|
Brazils popluation will double in about
: Over the past 50 years , Brazils population growth rate has average about 2.3 percent. According to the rule of 70, Brazils popluation will double in about ?
|
Write a function called stream-map
: Write a function that produces a stream of positive prime numbers . Use that stream to create a list of the product of all pairs of consecutive prime numbers up to a given value.
|
Is the value of intermediate goods and services included
: Why must the total value of expenditures in the economy be equal to total income? Is the value of intermediate goods and services included in GDP? Explain.
|
What is general industries expected current share price
: general industries is expected to generate $22 million, $26 million, $29 million, $30 million, and $32 million in free cash flows over the next five years, after which free cash flows are expected to grow at a rate of 3% per year.
|
Find the minimum power rating of the car
: An electric car accelerates for 11 s by drawing energy from its 270-V battery pack. Find the minimum power rating of the car
|
Determine what is the companys wacc of par
: The first bond issue has a face value of $85 million, has a 7 percent coupon, and sells for 97 percent of par. The second issue has a face value of $50 million, has an 8 percent coupon, and sells for 108 percent of par.
|