Lecture 2: Definitions
This assignment is due on Tuesday, January 11 at 11:59pm. Submit it using Handin as assignment lecture2. You only need to submit the first 7 exercises. Your submission is only accepted if the message “Handin successful” appears.
1 Install the Handin plugin
Open DrRacket. (Don’t open Racket.)
In the File menu, choose “Install .plt file”
In the dialog box, enter the following URL: http://www.cs.indiana.edu/classes/c211/c211-handin.plt
Make sure you enter this URL exactly.
Troubleshooting If you try to copy the URL above and paste it into the dialog box, but the text box seems to remain empty, try hitting backspace once or twice.
Troubleshooting If you try this installation procedure on a lab computer, you might get some red messages likeopen-output-file: error opening file
path: C:\Program Files\Racket\collects\c211-handin\compiled\tmp16418232271641823366937
system error: Access is denied.; win_err=5
But as long as you see “Installation complete.” at the bottom, Handin may well work fine after you restart DrRacket!Restart DrRacket.
Troubleshooting If your computer gets stuck for more than a minute at the message “Connecting to server” or “Making secure connection” when you try to use Handin, make sure that your computer is not connected to the Internet through the “IU Guest” wireless network. Instead, use another network such as “IU Secure”, “eduroam”, or tethering to a cell phone. Also, check for any program on your computer (perhaps firewall or protection software) that might be blocking outgoing connections to port 17979.
Important Make sure that your Handin username is the same as your IU login username. However, do not use the same passphrase. Under “full name”, put the full name you’d like us to use in this class.
2 Defining constants (variables)
Introduce a constant definition for the original image you downloaded, so that the Definitions Window contains only a single copy of a single image.
You can submit any assignment any number of times until the deadline. (We do not accept late submissions.)
In case you make a mistake, Handin sometimes provides helpful messages.
In case you lose your work, you can retrieve your submission from Handin.
We only grade your last successful submission. (Moreover, only your Definitions Window is submitted, so each time you submit, your Definitions Window should include all your work so far on that assignment.)
The code written in the videos above is available for your reference. To download it, don’t use “Save Page As” or “Save As”; use “Save Link As” or “Download Linked File” in your Web browser. If you can’t find the command, try right-clicking or two-finger-tapping or long-pressing.
3 Defining functions
; framed : Number -> Image
Try to use this new function shrink in the Interactions Window.
Pay attention to how this new shrink function uses your existing function framed. In other words, the definition of shrink contains (framed ...). The input to framed is the proportion (expt 0.99 n); this sub-expression uses the built-in function expt for exponentiation.
Optional: Review operators and definitions.
Optional: Enjoy more examples of animate.
For the rest of this page, you don’t need to submit anything, but do watch the videos and try the exercises anyway. We’ll work through the material together in class.
Exercise 8. Show the calculation of (shrink 50) step-by-step. Use the Stepper to confirm that your steps are correct.
Optional: Read Chapter 2 of the textbook.
Optional: Learn a little more about DrRacket.