1

Below is is a scheme function. For your answer, write a comment for this piece of...

Question

Below is is a scheme function. For your answer, write a comment for this piece of...

Below is is a scheme function. For your answer, write a comment for this piece of code in valid scheme syntax. (define (facto
Below is is a scheme function. For your answer, write a comment for this piece of code in valid scheme syntax. (define (factorial n) (if (=n0) (* n (factorial (- n 1))))) The elements to include in your comment that is described in your own w ords (succinctly, such as if you were commenting code instead of a survey) ... 1) the necessary formatting to indicate it is a legal scheme comment 2) expected input 3) expected output 4) what is the purpose of this function

Answers

The solution of the given problem is below:

here the code given is a scheme function for factorial . in scheme programming comments starts with a semocolon.

; the input n is a  number whose factorial is to be determined.

; let the input is 5 then above program work like this.

; since 5>0 so (*5 (factorial(5-1)))))

; again factorial will be called with n=4 so   (*4(factorial(4-1)))))

; (*3(factorial(3-1)))))

; (*2(factorial(2-1)))))

; (*1(factorial(1-1)))))

; factorial(0) will return 1 in this way it is calculated.

The ans of 2nd part is option 4.

generally comments are useless because compiler ignores it while compiling, but some times we need to add comment in order to tell that what our program does and its functions.

Plaese upvote in case of any query comment me.


Similar Solved Questions

1 answers
Two corners of an isosceles triangle are at #(2 ,5 )# and #(4 ,8 )#. If the triangle's area is #6 #, what are the lengths of the triangle's sides?
Two corners of an isosceles triangle are at #(2 ,5 )# and #(4 ,8 )#. If the triangle's area is #6 #, what are the lengths of the triangle's sides?...
1 answers
An 6.5m span simply supported beam is laterally unsupported between both ends . The beam bent...
An 6.5m span simply supported beam is laterally unsupported between both ends . The beam bent about its majo r axis and is subject to a transverse distributed factored load of 10 kN/m (including a self weight allowance). It is required to find an economic section to carry the given loads. (Fy=350MPa...
1 answers
The monthly market basket for consumers consists of pizza, t-shirts, and rent The table below shows...
The monthly market basket for consumers consists of pizza, t-shirts, and rent The table below shows market basket quantities and prices for the base year (Year 1) and in the following year Base Year (Year 1) Quantity 20 Price in the Base Year Price in Year 2 Product Pizza T-Shirts Rent $3.50 $25.00 ...
1 answers
Q1. Assume that the registers have the following values (all in hex) and DS=311F, SS=560B, SI=130F,...
Q1. Assume that the registers have the following values (all in hex) and DS=311F, SS=560B, SI=130F, DI=0405, BX=5011, AX=401D, CX=4500, and BP=195F. Calculate the physical address of the memory where the operand is stored and the contents of the memory locations in each of the following addressing e...
1 answers
1) Catching a cold during cold and flu season. For the two situations below, you can...
1) Catching a cold during cold and flu season. For the two situations below, you can only use the binomial and Poisson distributions for one or the other, meaning you will use a different distribution for the two scenarios. Justify your selection for which distribution to use for each scenario in yo...
1 answers
QUESTION 2 Citysites Sdn. Bhd. uses a job-order costing system. On Sept 1, Materials and Supplies...
QUESTION 2 Citysites Sdn. Bhd. uses a job-order costing system. On Sept 1, Materials and Supplies Control account had a balance of $28.000, whilst the Finished Goods (Job X10) balance on the same date was $15,000. Work in process as at Sept 1 consists of 2 jobs. Details as follows: Job Materials ($)...
1 answers
Please do 3.10 0 0 10 10 10 the head of a social services agency, you...
Please do 3.10 0 0 10 10 10 the head of a social services agency, you be of 20 social workers is ve lieve that your staff overworked compared with 10 loads for each worker are reported below for each the two years in question. Has the average caseload increased? Which measure of central tendency ...
1 answers
Please write a full paragrah. At least 500 words Why is it so hard for us...
Please write a full paragrah. At least 500 words Why is it so hard for us to take advice from others?...
1 answers
Please answer all 1 pts Question 5 Calculate the RMS speed of molecules of carbon-dioxide gas...
please answer all 1 pts Question 5 Calculate the RMS speed of molecules of carbon-dioxide gas at atmospheric pressure and 324 degrees C. Question 6 1 pts Five gas molecules are found to have speeds of 185, 199, 261, 139, and 165 m/s. The rms speed (in m/s) is 1 pts D | Question 7 Find the specifi...
1 answers
What is the slope of the line passing through the following points: # (1, 3), (6,2)#?
What is the slope of the line passing through the following points: # (1, 3), (6,2)#?...
1 answers
When they send out their fundraising letter, a philanthropic organization typically gets a return from about...
When they send out their fundraising letter, a philanthropic organization typically gets a return from about 5% of the people on their maling list To see what the response rate might be in the future, they did a simulation using samples of size 20, 50, 100, and 200. For each sample size, they simula...
1 answers
This is a question with subsection, please help me Question 9 0.42 pts Use the following...
this is a question with subsection, please help me Question 9 0.42 pts Use the following information and diagrams to answer the questions below. Four identical bars are free to rotate at their centers. A force of the same magnitude is applied to each bar, but in different locations and/or in d...
1 answers
The following series of transactions occurred during Year 1 and Year 2, when Linwood Co. sold...
The following series of transactions occurred during Year 1 and Year 2, when Linwood Co. sold merchandise to John Moore. Linwood's annual accounting period ends on December 31. 10/01/Yr 1 Sold $12,000 of merchandise to John Moore, terms 2/10, n/30. 11/15/Yr 1 Moore reports that he cannot pay the...
1 answers
Part B - Automata Construction Draw a DFA which accepts the following language over the alphabet...
Part B - Automata Construction Draw a DFA which accepts the following language over the alphabet of {0,1}: the set of all strings such that the number of 0s is divisible by 2 and the number of 1s is divisible by 5. Your DFA must handle all intput strings in {0,1}*. Here is a methodical way to do th...
1 answers
The water pump, as shown in the figure below, maintains a pressure of 6.5 psig at...
The water pump, as shown in the figure below, maintains a pressure of 6.5 psig at point 1. There is a filter, a half-open disk valve, and two regular screwed elbows. There are 80 ft of 4-inch diameter commercial steel pipe. For water, take ρ = 1.94 slug/ft3 and μ = 2.09E−5 slug/ft⋅...
1 answers
3. Given pairwise orthogonal vectors u, v, w ER(each vector is orthogonal to every other), with...
3. Given pairwise orthogonal vectors u, v, w ER(each vector is orthogonal to every other), with || || = ||0|| = ||w|| = 1, and C1, C2, C3 € R, prove that || Cu + c2v + c3w||2 = cſ + cx+cz....
1 answers
Salmone Company reported the following purchases and sales for its only product. Salmone uses a perpetua/inventory...
Salmone Company reported the following purchases and sales for its only product. Salmone uses a perpetua/inventory system. Determine the cost assigned to cost of goods sold using LIFO. Units Sold at Retail Date Activities May 1Beginning Inventory 5 Purchase 10 Sales L 15 Purchase 24Sales Units Acqui...

-- 0.008878--