This is an old revision of the document!
Learn the basics of the Racket Language and functional programming in general.
Download the latest version of DrRacket from http://racket-lang.org and install it on your computer. Versions are available for Windows, Mac OS X, and Linux.
For this lab, you will need to implement the following functions and data structures in Racket:
(define (sum-coins pennies nickels dimes quarters) ...)
where pennies
, nickels
, dimes
, and quarters
are all non-negative numbers and the value returned is the total value of the coins.
(define (degrees-to-radians angle) ...)
where angle
is a number representing a value represented in degrees and the value returned is the equivalent representation in radians. (For those who have forgotten their trig: radians = degrees / 180 * PI.)
(define (sign x) ...)
where x
is a number and the value returned is -1, 0, or 1 depending on whether x
is negative, zero, or positive respectively.
(define (new-sin angle type) ...)
where angle
is a number representing either degrees or radians, type is either 'degrees
or 'radians
(a symbol) indicating how angle
is represented, and the value returned is the sin of angle
.
You do not need to bulletproof the code to enforce proper inputs. Your code only needs to return correct values given correct inputs.
Try using the