Question: please program with functional programs in Dr. Racket Scheme. 4. Define a procedure read-for-square to read a value for the square procedure defined above. This

please program with functional programs in Dr. Racket Scheme.
4. Define a procedure "read-for-square" to read a value for the square procedure defined above. This procedure takes no parameters and will take an input value from keyboard and pass to the Square procedure defined above. [5 points) > (read-for-square) ; enter 5 from keyboard 25 5. Define a procedure "diff-squares that will compute the difference between the square values of 2 inputs. You must implement the read-for-square procedure defined above. This procedure should never return a negative value, as it should return the absolute value. [5 points) > (diff-squares) 5 ; input 10 ; input 75 ; output 6. Create a recursive procedure called (sum-odds max), where max is a number. The procedure should return the sum of all positive odd numbers up to and including max. For example: (sum- odds 10) should give 25. (Hint: you can check if a number is odd using the form odd?) [8 points] 7. Create a recursive procedure called (fib a) to compute terms in the Fibonacci sequence: given a, find the a'th Fibonacci number. Sample output: (fib O) should give 0, (fib 9) should give 34. [8 points) 4. Define a procedure "read-for-square" to read a value for the square procedure defined above. This procedure takes no parameters and will take an input value from keyboard and pass to the Square procedure defined above. [5 points) > (read-for-square) ; enter 5 from keyboard 25 5. Define a procedure "diff-squares that will compute the difference between the square values of 2 inputs. You must implement the read-for-square procedure defined above. This procedure should never return a negative value, as it should return the absolute value. [5 points) > (diff-squares) 5 ; input 10 ; input 75 ; output 6. Create a recursive procedure called (sum-odds max), where max is a number. The procedure should return the sum of all positive odd numbers up to and including max. For example: (sum- odds 10) should give 25. (Hint: you can check if a number is odd using the form odd?) [8 points] 7. Create a recursive procedure called (fib a) to compute terms in the Fibonacci sequence: given a, find the a'th Fibonacci number. Sample output: (fib O) should give 0, (fib 9) should give 34. [8 points)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
