Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Open a terminal.
  2. Make a new folder (directory) called Comp211, for this course. The command is for making a new folder on Linux is mkdir.
  3. Make a sub-folder in Comp211 called Labs.
  4. Make a sub-folder in Labs called Lab01 Lab00. Save all your Lab01 Lab00 work to this folder. For submitting homeworks, see the Owlspace page for Comp 211.
  5. Start DrSchemeby typing the command drscheme.
    #If this is the first time you've run DrScheme, it will ask you your preferred language, and the Scheme language level; the latter should be "Beginning Student with List Abbreviations". This language level provides the expected set of primitive operations and enables DrSchemeto reject "legal" Scheme constructions that are not part of our introductory dialect.

...

  1. Type (or copy/paste) the following expressions into the interactions window
    Code Block
    (+ 2 7)
    
    Code Block
    (* (+ 2 7) 3)
    
  2. Type (or copy/paste) the following blocks of code into the definition window, including:
    Code Block
    ;; contract:
    ;; owe: nat -> num
    ;; purpose:
    ;; (owe n) returns how much money you owe for eating n slices of pizza.
    ;; definition:
    (define (owe slices)
       (* (/ 12 8) slices))
    
    Observe that DrSchemehelps you with the indentation if you use the Return key in appropriate places. It also "bounces" the cursor to visually match the closing parenthesis with the corresponding opening parenthesis.
  3. Use the definition of owe by typing in the interaction window some Scheme expressions using those definitions, e.g.,
    Code Block
    (owe 5)
    
    (owe 7)
    
  4. We included comments before each function definition, explaining what it is supposed to do. DrSchemeignores the comments, but you, your grader, your boss, etc., can read them. Soon, we'll provide more guidance on what to say in your comments.
    Code Block
    ; One form of comments is anything following a semicolon
    ; up to the end of the line.
    ;; However, you'll often see two semicolons starting a comment.
    
    #|
      Another form of comments is anything between these
      two matching markers.
    |#
    
    You can also go to the Special menu, choose Insert comment box. You are welcome to do this, but one caveat: if DrSchemesaves a file which includes a fancy comment box, the file will not be saved in plain-text format. (This is only an issue if you want to open or print the file with a different program later.)
  5. Edit your definitions or comments some. You can use the mouse, the arrow keys, backspace, and standard keyboard shortcuts to move the cursor around. Also, the PC, Mac, and Unix versions of DrSchemeeach use their respective standard keyboard shortcuts. (You can look in the Edit menu under Keybindings for the complete list.)
  6. Load the definitions into the interaction window by clicking on the Run button. If DrSchemedetects any syntactic errors, it will give you an error message in the interactions window and highlight the error in the definitions window.
  7. Save your work in your Comp211\Labs\Lab01Lab00 directory. Be sure to use a filename that has a .ss extension. You don't need to turn in your lab work. In fact, you don't have to save it, but we recommend it so that you can look at it again.
  8. Finally, intentionally introduce an error or, what you think will be an error, press Run, and see what error message is given. We'll go around the room to see what different error messages people get. Do the error messages tend to make sense?

...