Before you can start on the lab, you need to log in to a lab computer and change your password:
Even though you will be working in pairs or groups, every person needs to change their password before starting the lab.
The lab is done in groups of 2 or 3. You will use a pair-programming approach: one person is a "driver", i.e. types in program instructions, and the other person is a "navigator", i.e. guides the driver as to what to type and what to do next. The roles are switched every 10-15 minutes. For this lab it will be convenient to switch at the end of each exercise. If you are working in groups of three, the roles are: a "driver", a "navigator", and a "quality control" person. Again, make sure to switch frequently.
Start DrRacket by going to Applications, then Programming, and then clicking on DrRacket. Make sure that the language is set to "Beginning student". If it's not, go to "Language" menu of DrRacket and set it. Also, if you have troubles accessing image functions (in problem 3) then go to "Language -> Add Teachpack" and add "image.rkt" from the middle column.
If you have accidentally added the teachpack from the first column, you will be getting error messages when using image functions such as rotate, either that the function definition is not found or that a module has been imported twice. If this is happening, clear both image.rkt teachpacks and then add the one in the middle column.
Start your lab by typing a comment in the beginning of the file with the lab number and the names (first and last) of all group members. Recall that Racket comments are lines that start with ; (a semicolon).
You should create a folder for your work in this class, and possibly a subfolder for the lab so that you can keep each lab and each problem set in a separate folder. In order to save a file go to "File -> Save Definitions As..." and navigate to your folder. Make sure to save your file with the extension .rkt. After you've done it once you can just use "Save" (or Ctrl-S) to save the file.
You may do all yoru work in one file or in separate ones, whichever you find convenient. Make sure to submit all your files.
At the end of the lab please send me and your group partner(s) all your Racket files as e-mail attachments. My e-mail is elenam at morris.umn.edu. The subject of your e-mail must be "1301 Lab 1" followed by "Final" or "Not final", depending on whether this is a final submission or you are still working on it. If you need to finish it, make sure to set up a time with your group partner(s) to finish the lab.
Due Monday, September 9, at 11:59pm. If you submit the final version during the lab, you are done.
Please write Racket expressions that correspond to the following infix expressions. Check your answers, ideally using check-expect.
1.5 * 2 + 21/3
(3 + 2 + 7)/(11 - 1 - 4)
(3*(-2 +4))/(8/2 + sqrt(4))
cos(0) + sin(0)
, where cos
and sin
are the cosine and sine functions,
respectively. Racket uses cos
and sin
as
function names.
Find out what the following Racket functions do by testing them on
different arguments:
<=, max, gcd
.
For example, what happens if a function is applied to more than two
arguments?
Please submit all of the tests that you tried to determine
what the function does. Explain your findings in comments. You may
read the function
descriptions here
if you would like, but the
descriptions of the functions that you submit for the lab
must be your own.
Your task is to use functions in image.rkt teachpack to create a shape that has a side of 200 pixels and looks like this:
There are different ways of creating this shape. Some functions that you may find helpful are: square, triangle, right-triangle, rectangle, rhombus, rotate, overlay, beside, above.
Use variable as you find useful. For example, if you are using an image more than once, you might want to save it in a variable. Good use of variables is one of the criteria used for evaluating your work. The best solutions for this problem will be shown in class.
Do not use check-expect for images at this point since it doesn't always work as expected.
Test three "what if" questions of your choice in Racket. For example, you might want to try applying + function to strings. Write down what you think is going to happen, test it, and write down if that was what you expected. If an expression that you test results in an error, comment it out before you move on to the next one.