Logo
  • Home
  • Classes
  • Conveying Computing
  • Exams
  • Fractal Gallery
  • Guides
  • Problem Sets
  • Syllabus

Problem Set 0: Course Registration, Racket

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.

Collaboration Policy

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.

Purpose

  • Learn the mechanics of downloading and turning in CS1120 assignments.
  • Gain familiarity with the DrRacket IDE.
  • Take your first steps using Scheme.
  • Register for the course by providing some information about yourself.

Before going further, you should read the DrRacket Guide and either set up DrRacket and your cs1120 directory on your own machine, or on a public ITC machine. Start running DrRacket, and select the Pretty Big language following the directions in the DrRacket Guide.

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.

Evaluating Expressions

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

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.

0. What is your UVa computing ID?

(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 ).

1. What is your name?

(define my-name "[your full name]")
2. What would you like the course staff to call you? (If your name is hard to pronounce, please also include a phonetic spelling or explanation of how to pronounce it.)

(define call-me "[your full name]")
3. What is your class year? For this one, your value should be a number indicating your class year (e.g., 1 if you are a first year, 2 if you are a second year, etc.; use 0 if you are a pre-University student, or 5 if you are a post-graduate). Note that this value is a number, not a string, so it should not be surrounded by quotes.

(define my-year [number])
4. What is your primary major? (If you haven’t declared a major yet, but think you know what you want to do, use, “Undeclared-“, e.g., (define primary-major "Undeclared-Burrito Making").)

(define first-major "[major]")
5. If you have, or plan to have a second major, what is your second major? (If you don’t plan to have a second major, you do not need to answer this.).)

(define second-major "[major]")
6. Why are you taking this class?

(define why-taking "[answer (can be many lines, so long as they are enclosed in the quotes)]")
7. Do you have any previous experience programming computers? (Answer using either true, if you have any programming experience, or false, if you have never written a comptuer program. Note that here you are providing a Boolean value, not a string in quotes. You should remove the square brackets, leaving the value either true or false.)

(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):

8. What programming languages have you used and how much?

(define programming-languages "[list the programming languages you have used and what you have done with them]")
9. Do you have a laptop? (Like question 7, this is asking for a Boolean value answer. If your answer is complicated, though, you can provide a string in quotes instead.)

(define have-laptop [true or false])
10. How is your intellectual hero and why?

(define intellectual-hero "[your answer]")
11. (Optional) Is there anything else you would like to know about this course, the teacher, or computing?

(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.

Electronic Submission: Submit a single file (ps0.rkt) that includes all your answers to the Alonzo-Bot: https://church.cs.virginia.edu/cs1120/ps0.html. You will need to login using NetBadge to submit your file. You may submit as many times as you want; only the last submission counts.

Print Friendly Print Get a PDF version of this webpage PDF

Leave a Reply Cancel reply

You must be logged in to post a comment.

cs1120 | RSS | Comments RSS | Book | Using These Materials | Login | Admin | Powered by Wordpress