1) Describe in your own words the fundamental concept behind declarative programming paradigm
2) Explain what is happening below. Why are these results looking like this? Describe why it is happening in your own words.
>(-10.2 10)
0.1999999999999993
>(-1.2 1)
0.1999999999999996
>(-1.4 1)
0.3999999999999999
>(-2.2 1)
1 .2000000000000002
3)Below is a scheme function. for your answer, write a comment for this piece of code in valid scheme syntax
(define( factorial n)
if(=n 0)
1
(*n(factorial(-n 1)))))
The elements to include in your comment that is described in your own words(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
4) How can you implement iteration (such as checking if there are any even elements in a linked list) in a purely functional language, when there's no loop variable concept?
This is a very big question.
I have solved all of them.
Please give me an upvote dear, Much
Appreciated.!!
.Given results are:
>(-10.2 10) has produced the result 0.1999999999999993 but NOT 0.2.
(-1.2 1) has produced the result 0.1999999999999996 but NOT 0.2 and so on
The reason behind all these is "Floating Point Precision"
Here, we have a float value like 10.2, it is actually stored in the system as 10.19999999999999999999...
It is because we have to store the float number in the IEEE format.
When we perform a subtraction operation, we will lose this precision and get these results.
Code: Please note that anything after a colon is a comment ; THIS IS COMMENT
SOURCE CODE:
*Please follow the comments to better understand the code.
**Please look at the Screenshot below and use this code to copy-paste.
***The code in the below screenshot is neatly indented for better understanding.
; declare the function here
(define (factorial n)
; check the condition if n value is less than 0
(cond ((< n 0) )
((<= n 1) 1) ; If the condition is true, return 1
(else (* n (factorial (- n 1)))))) ; Else call the function recursively.
; This function will calculate the FACTORIAL of the number
; Example:
; 5! = 5*4*3*2*1 = 120
; 6! = 6*5*4*3*2*1 = 720 and so on
Code screenshot:-
INPUT and OUTPUT
4. It will calculate the Factorial of a number.
1) Describe in your own words the fundamental concept behind declarative programming paradigm 2) Explain what...
QUESTION 1 How can you implement iteration (such as checking if there are any even elements in a linked list) in a purely functional language, when there's no loop variable concept? O Recursion O Declaring type signatures O Writing out clear, concise comments Find a dragon to help you QUESTION 2 Explain what is happening below. Why are these results looking like this? Describe why it is happening in your own words. >(-10.2 10) 0.1999999999999993 >(-1.2.1) 0.19999999999999996 >(-1.41) 0.3999999999999999 >(-2.2...
Describe in your own words the fundamental concept behind declarative programming paradigm.
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...
Describe in your own words what role the hippocampus plays in Declarative Memory (also known as Explicit Memory). Is the hippocampus also necessary to form new Non-Declarative Memories (also known as Implicit Memories)?
1) In your own words explain the concept of "educare"? 2) describe the main principals caregiving strategies and benefits for children, families and educarers?
Explain, in your own words, why formatting Excel spreadsheets is important. Also, describe 2 examples of spreadsheets in which formatting is critical for those reading and interpreting the spreadsheet. Think about what the spreadsheet may represent and how formatting can enhance its readability. Your answer must be a minimum of 2 paragraphs
1. Define and explain the concept of “law” and its importance. In your own words submit a detailed response of at least 60 words. (10 pts ) 2. Which two of the discussed sources of law should be preferred in your opinion and why? Submit a detailed response at least 75 words. ( 10 pts ) 3. Explain and distinguish natural law from legal realism. Provide one example of each. Submit a detailed response of at least 60 words. (...
1. Using complete sentences, describe the octet rule in your own words. What family of elements satisfies the octet rule without making a compound or molecule? What makes aluminum likely to form an electron deficient compound (with less than a full octet) but the smaller atom fluorine will not? 2. 3. Count the valence electrons for NO2 and NH4"
Describe the process using your own words the changes that the concept of stress has undergone from Bernard to Sterling and Eyer (1988). TABLE 1.3 Evolution of concepts of stress Stage 1: Claude Bernard: Disruption to the ability to maintain a constant fluid environment bathing cells of the body–the internal environment. Stage 2: Walter Cannon (1929, 1939): Threats to homeostasis evoke activation of the sympathoadrenal system as a functional unit. The concept of homeostasis suggests that regaining balance only requires...
Part 1: In your own words, define a function. Part 2: Code the following function in C++. The function is named potential. It receives three double type parameters (mass, gravity and height). It multiplies all three parameters to calculate potential energy which is returned as a double. Just paste the code for the potential function - no main function is required.