Frequently Asked Questions

Table of Contents

Written by lgilpin, kclisp

Updated Spring 2021

1 Welcome

Welcome to 6.945/6.905, Adventures in Advanced Symbolic Programming!

If you have read the Don't Panic! memo and you're still having trouble, or you just have some general questions, this page is for you. I will be populating this page with common questions from the class, and general questions about emacs and MIT/GNU Scheme.

Email with additional questions.

2 Scheme Questions

2.1 Is there a book to learn Scheme?

Unlike most programming languages, there is no "how-to" book that I can recommend to learn scheme. If you're a beginner, I suggest reading The Structure and Interpretation of Computer Programs. You can also read The MIT/GNU Scheme documentation.

2.2 What are the commenting conventions?

In scheme, the ; character is the comment character. But historically, the number of ; characters used has meaning. Four semicolons describe the file. Three describe the next function. Two describe the next chunk of code. One describes the line. As in:

;;;; Mathematical Functions
;;; Fibonacci numbers
(define (fib n)
  ;; Calculate the nth Fibonacci number recursively
  (if (< n 2)
      1                                 ; base case
      (+ (fib (- n 1)) (fib (- n 2)))))

There is also the #| ... |# multi line comment, similar to the /* ... */ comment in C and C++. This comment is useful for including test cases. If you were completing the definition of fib for a pset, you might use a multi-line comment to include test cases like so:

 (fib 5)
;Value: 8

 (fib 20)
;Value: 10946

Note that you can evaluate the (fib 5) and (fib 20) scheme forms using C-M-x or M-z even though they are in comments.

Emacs knows about scheme's commenting conventions. You can insert and remove comments using M-;. If you select a region of code, it will comment or uncomment out the entire region.

2.3 How should I format my code?

The easiest way to grok it is by reading other people's well-formatted code. As a start, the format of parentheses are not like in C; end parentheses should go together.

For more guidelines, go here:

3 Workflow Questions

3.1 How do I learn emacs?

Practice, practice, practice! I highly recommend printing the emacs reference card and keeping it close to your computer at all times.

3.2 How do I format my code?

Emacs automatically correctly indents your code for you, but if your code is somehow not indented properly, here are some ways to indent it.

In Edwin and Emacs, pressing tab indents the line. Pressing C-M-q indents the sexp to the right of the point.

In Emacs, pressing C-x h selects the entire buffer. Pressing tab will then indent the entire file.

4 Logistics

4.1 How do I hand in the psets?

Please email me and GJS your code. As long as you include the code, test cases, and results, you'll be fine.

5 Random

5.1 What is Org mode?

I've started taking my own notes in org mode. Here is a reference card to get you started.

You can also read more about org mode at their home page. You may also be interested that this webpage (and the Don't Panic! memo) was built in org-mode.

Author: Leilani H. Gilpin, Kenny Chen

Created: 2021-02-21 Sun 21:27