Any function writen in a homework may be used within the same
homework to solve a given problem.
If you need to reuse a solution from a previous homework, you must resubmit
the function in the current homework.
Be sure to follow the guidelines as outlines by the homework
template and style guidelines documents.
Explain how computer science is different from computer engineering.
What character does Scheme use to comment out a line?
Give two good reasons why you would want to comment code.
What are the three main programming paradigms?
Which one does Scheme belong in?
What does it mean for a function to be one-to-one?
What does it mean for a function to be onto?
What symbols does Scheme use to represent true and false?
Express each of the following arithmetic expressions as a Scheme expression.
Be sure to preserve the standard order of operations.
(the symbol '*' denotes multiplication)
Format your answers like this:
(define (6a) (+ 1 1)) (define (6b) (+ 1 2))
a) 1 + 2 + 3 * 4 - 5 b) (19 + 6 - 2) / (3 * 2 * -8) c) 14 * (3 - 1.2) + -28.6 d) (1 + 3 + 5 + 7 + 9 + 11) * (3 / (4 - 6)) e) (1 + (1 / (1 + (1 / (1 + (1 / 1))))))
What is a parameter?
What are the three types of parameters?
Explain the differences between the types.
What is a literal?
Thoroughly explain the differences between compiled and interpreted languages.
What does it mean to talk about the domain of a function?
The range of a function?
Jo's hardware store sells bolts for $1.25 a pound, nuts for $1.85 a pound and washers for $0.76 a pound.
Write three functions to determine the cost to buy some amount of bolts, nuts, and washers.
Call your functions bolts-cost, nuts-cost, and washers-cost. Example usage:
> (bolts-cost 14) 17.5 > (nuts-cost 13) 24.05 > (washers-cost 11) 8.36
Now write a function called hardware-shopping which takes in three parameters in this order
It should return the total cost of the items. Example
> (hardware-shopping 14 13 11) 49.91
The area of a circle can be approximated by 3.14 times the radius squared.
Write a function called circle-area which takes in a radius and return the area of a circle with that radius. Example:
> (circle-area 1) 3.14 > (circle-area 3) 28.26
The volume of a cylider is given by the area of the circle that makes up the base times the height of the cylinder.
Write a function called cylinder-volume which will take in exactly two parameters:
and will return the volume of the cylinder. Example:
> (cylinder-volume 3 10) 282.6
Explain in your own words what recursion is.