Problem Set 0 is not graded, but you must submit it to be in the course. Use our automatic assignment submission service (following the directions at the end of the assignment) to submit your answers by 5:59 pm on Sunday, 28 August.
After you submit your assignment, you will be assigned a partner for Problem Set 1, so it is in your interests to submit this assignment as early as possible (but no later than 5:59pm on Sunday, 28 August).
This is the only assignment in cs1120 that is not designed to challenge you intellectually! Instead, it is meant to be straightforward and to get everyone up and running with the tools we will use in this class. This means if you get stuck with anything, please don’t hesitate to ask for help. You are strongly encouraged to take advantage of the scheduled help hours and office hours for this course.
For this assignment you may work with anyone you want, but must write and submit your own answers yourself. Just be sure that by the time you turn in the assignment, you could do the assignment completely on your own.
Click the Run button to interpret the definitions. DrRacket will split into two windows, with an Interactions Window on the bottom. If the language is set correctly, you should see:
Welcome to DrRacket, version 5.1.3 [3m].
Language: Pretty Big;
memory limit: 128 MB.
in your Interactions window.
Try evaluating some expressions in your Interactions window. Enter the expression at the > prompt in the Interactions window and press Enter. For example,
(+ 1 1)
should evaluate to 2.
Careful with the parentheses! Scheme is very particular about parentheses. When you type a ) in DrRacket, it will highlight the matching ( so you can see that the parentheses are balanced correctly.
Here are a few more expressions to try evaluating. See if you can guess what they will evaluate to before evaluating them in DrRacket.
(* 4 5)
(+ 1100 (* 4 5))
(print "Rock on Racket!")
Definitions provide a way to associate a name with a value. For example,
(define my-name "David Evans")
defines the variable my-name with the value “David Evans”. (The quotes are important! Without then, David Evans would look like two names to the Scheme interpreter, but it would be an error since the are undefined. With them, “David Evans” is a single string.)
For this assignment, and to register for the course, you need to define several variables with your answers to the registration questions.
You should enter your definitions in the Definitions window (the top half of DrRacket) so you will be able to save them in a file, instead of using the Interactions window. The variable names must match exactly (including the capitalization) the ones given below, and you should define each variable that provides your answer to the question.
Start by adding some comments at the top of your file. Everything from a ; to the end of a line is a comment that is ignored by the interpreter. The DrRacket editor colors comments orange. For example, you might put these lines at the top of your file (you only need one ;, but it usually looks better to use three):
;;; cs1120 Problem Set 0 ;;; [your computing ID] ;;; [your name]
For the rest of the questions, add your definitions to this file.
(define author "[your id]")
For example, I would do:
(define author "dee2b")
Test your definition by saving your program as ps0.rkt by selecting File | Save Definitions (or just Ctrl-s) and then making a file ps0.rkt in your cs1120/ps0 directory. Then, click “Run” to run your definitions. Since the file only has definitions, you won’t see any results. But, you can see that your definitions worked by evaluating the variable names in the Interactions window. Try evaluating author and you should see the ID you entered. Once you’ve tried this successfully, move on to the rest of the questions, adding each definition to your file. As you answer each question, you should try “Run” and checking your definition.
Pay attention to how the DrRacket editor helps you balance your quotes and parenthesis by changing the color of elements as you type. When you have just a open ", the unclosed string will appear red. When you type the closing ", the string becomes green. You may also want to experiment with what happens if you have an unmatched ).
(define my-name "[your full name]")
(define call-me "[your full name]")
(define my-year [number])
(define first-major "[major]")
(define second-major "[major]")
(define why-taking "[answer (can be many lines, so long as they are enclosed in the quotes)]")
(define programming-experience [true or false])
It is not expected that students entering this class have any previous programming experience, but if you do, also answer the next question (otherwise, skip to question 9):
(define programming-languages "[list the programming languages you have used and what you have done with them]")
(define have-laptop [true or false])
(define intellectual-hero "[your answer]")
(define my-question "[your question]")
That's it! Now, remember to save your program again and click "Run" to run your definitions. Check the definitions are correct by evaluating the variable in the Interactions window. Once you are happy with your answers, use the electronic submission link below to submit it.