Question
1. Define a procedure Add that takes parameters and returns the sum of them. > Add( 40 60 ) 100 3. Define a procedure called
> Add( 40 60 )
100
3. Define a procedure called Square that will compute the square amount of a value.
3.1 You must implement the Add procedure defined above.
3.2 You will need to account for negative values as well.
Hint: This will require a conditional and possibly the (abs x) procedure.
> (square 7)
49
4. Define a procedure ReadForSquare to read a value for the Square procedure defined above. This procedure takes no values and will pass an input value to the Square procedure.
> (ReadForSquare)
-5
25
5. Define a procedure DiffSquares that will compute the difference between the square values of 2 inputs. You must implement the ReadForSquare procedure defined above. This procedure should never return a negative value, it should return the absolute value.
> (DiffSquares)
5
10
75
6. Re-implement the procedure Add and call it AddLet. In this procedure, you must implementlet-formto bind values. You may name the variables whatever youd like. [5 points]
> (AddLet 60 40)
100
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started