Question

Four function calculation. Please write this code in Scheme. (Please dont write this code in java,...

Four function calculation.
Please write this code in Scheme. (Please dont write this code in java, c++ or sql. Only in Scheme.) just write the code on Four function calculation.

CODE WILL BE IN SCHEME LENGUAGE.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Sample run:

Scheme code with comments:

(define (ffcalculator expression)
(cond ((null? expression) 0) ; base condition handling zero and one terms
((null? (cdr expression)) (car expression))
(else ; to handle three or more terms
(let ((operand1 (car expression))
(operator (cadr expression))
(operands (cddr expression)))
((case operator ; convert operator and symbol to corresponding function
((*) *)
((/) /)
((+) +)
((-) -))
operand1
(ffcalculator operands)))))) ; evaluate the rest of the expression recursively

Add a comment
Know the answer?
Add Answer to:
Four function calculation. Please write this code in Scheme. (Please dont write this code in java,...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Please use matlab, post the code, and dont just write the code by hand. Thank you!...

    Please use matlab, post the code, and dont just write the code by hand. Thank you! 4 [3 points] Use the function f(x on the interval [5, 5] and the 11 points below to find a N-10 Lagrange polynomial, using MATLAB. You will need to write code for and plot the polynomial as a function of x, but you do not have to write the polynomials down by hand 5 0 2 3 4 5 f(x) | 0.0399 | 00623...

  • Please write in Java in Jgrasp check code before posting Please write in Java in Jgrasp...

    Please write in Java in Jgrasp check code before posting Please write in Java in Jgrasp check code before posting Please write in Java in Jgrasp check code before posting, will give thumbs up FOP- 2. Write a program that ciphers a plain text message using double transposition scheme and vice versa. [50 Marks) The program should accept five tuples of input: plain text, row, column, permutation of row and columns. An example of encrypted text for the plain text...

  • Use C/C++/Java/VBasic only for writing the code. II Tower of Hanoi Write a recursive function that...

    Use C/C++/Java/VBasic only for writing the code. II Tower of Hanoi Write a recursive function that implements the Tower of Hanoi problem. Draw a control flow graph for this function.

  • write in java and please code the four classes with the requirements instructed You will be...

    write in java and please code the four classes with the requirements instructed You will be writing a multiclass user management system using the java. Create a program that implements a minimum of four classes. The classes must include: 1. Employee Class with the attributes of Employee ID, First Name, Middle Initial, Last Name, Date of Employment. 2. Employee Type Class that has two instances of EmployeeType objects: salaried and hourly. Each object will have methods that calculates employees payrol...

  • Type down the code so I can copy it directly please. Dont write on papers or...

    Type down the code so I can copy it directly please. Dont write on papers or dont provide it as screenshots, only type it please. I will upvote too. Thanks. Figure 3 shows the connection between a common anode 7-segment display, three switches and an FPGA. Write the VHDL code that can be used to display odd numbers, given as an input using the three switches, on the 7-segment display. In the case of even numbers, display the letter 'E'....

  • please dont write the VHDL code on paper just copy and paste it from the program...

    please dont write the VHDL code on paper just copy and paste it from the program Q1 K101 Fig. 2 (b) Use the structural design style to write the VHDL code (entity and architecture) to describe the circuit in Fig. 2 if the entity of the JK flip-flop is as shown below: entity JKYT is port( Q. NO: out atd logies CLK, CLR, J, K instd_logie); and JKPF; (5 marks)

  • In the following graph, write a Java program using Topological Sort. please write java code and...

    In the following graph, write a Java program using Topological Sort. please write java code and show me the output. Thank you :) b.

  • Please code this in Java, thank you! (a) Implement a sublinear running time complexity recursive function...

    Please code this in Java, thank you! (a) Implement a sublinear running time complexity recursive function in Java public static long long x, int n) to calculate X Note: In your function you can use only the basic arithmetic operators (+, -,, %, and /) (b) What is the running time complexity of your function? Justify (c) Give a number of multiplications used by your function to calculate x63.

  • Please Provide me all Necessary Screenshot with copy able code. Thanks Write a scheme function named...

    Please Provide me all Necessary Screenshot with copy able code. Thanks Write a scheme function named up-to-first-number that takes a list as its input and returns a list containing all the elements up to the first numeric element in the input list. You can use the number? predicate function to determine whether an element is a number or not. Sample runs: (up-to-first-number '(a b c d 1 2 3 )) returns (a b c d) (up-to-first-number '(d e f 7))...

  • 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 (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...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT