User Tools

Site Tools


cs330_f2016:racketbasics

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cs330_f2016:racketbasics [2018/01/11 20:13]
morse [Preparation:]
cs330_f2016:racketbasics [2021/06/30 23:42]
Line 1: Line 1:
- 
-====Objective:​==== 
- 
-Learn the basics of the Racket Language and functional programming in general. 
- 
----- 
- 
-====Preparation:​==== 
- 
-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. 
- 
-Please also take a look at [[cs330_f2016:​turnin|how to turn in your assignments]]. ​ 
- 
----- 
- 
-====Deliverables:​==== 
- 
-For this lab, you will need to implement the following functions and data structures in Racket: 
-  * ''​sum-coins''​ 
-  * ''​degrees-to-radians''​ 
-  * ''​sign''​ 
-  * ''​new-sin''​ 
- 
-=== sum-coins === 
-<code racket> 
-(define (sum-coins pennies nickels dimes quarters) ...) 
-</​code>​ 
-where ''​pennies'',​ ''​nickels'',​ ''​dimes'',​ and ''​quarters''​ are all non-negative numbers and the value returned is the total value of the coins in cents. 
- 
-=== degrees-to-radians === 
-<code racket> 
-(define (degrees-to-radians angle) ...) 
-</​code>​ 
-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.) 
- 
-=== sign === 
-<code racket> 
-(define (sign x) ...) 
-</​code>​ 
-where ''​x''​ is a number and the value returned is -1, 0, or 1 depending on whether ''​x''​ is negative, zero, or positive respectively. 
- 
-=== new-sin === 
-<code racket> 
-(define (new-sin angle type) ...) 
-</​code>​ 
-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''​. 
- 
-Hint: use ''​symbol=?''​ to test for symbol equality: ''​(symbol=?​ x '​degrees)''​. 
- 
----- 
-====Notes:​==== 
- 
-You **do not** need to bulletproof the code to enforce proper inputs.  ​ 
-Your code only needs to return correct values given correct inputs. 
- 
----- 
- 
-====Hints:​==== 
- 
-Try clicking on the Step button to walk through your code and watch the equivalent sequence of substitutions that are performed. 
- 
- 
  
cs330_f2016/racketbasics.txt ยท Last modified: 2021/06/30 23:42 (external edit)