Project 3a: Learning Emacs and LISP

Reading

Download and read the following:

What to hand in

For full marks in this project, print out and give me a hard copy of

For 2.5 bonus marks, give me a hard copy of

Note: to create the transcripts, run the whole thing in EMACS (using the instructions below), then save the interaction buffer (using Control-X-S).

Part 1: Learning Emacs

Setup

Run the following commands:

mkdir -p ~/opt/tmp/backup
mkdir -p ~/opt/iccle/etc/color-theme/color-theme-6.6.0
mkdir -p ~/cs310/proj3a
cd $HOME
cp ~timm/.emacs $HOME
cd ~/opt/iccle/etc/color-theme/color-theme-6.6.0
cp -r  ~timm/opt/iccle/etc/color-theme/color-theme-6.6.0/* .

Now, does your emacs installation work? To check that, run the following nine tests. Note, if the following, if you see:

Test1: split horizontal

% cd ~/cs310/proj3a
% emacs
Control-X 2

Can you grab the horizontal barrier and pull it up and down?

Test2: split vertical

Control-X 3

Can you graph the vertical barrier and pull it right and left

Test3: cursor movement

If you click on each of the buffers, does the cursor move around?

Test4: open a file

C-x C-f spels.lisp

Can you enter this text

(defun hello-world () 
	(print "hello world"))

Test5: save a file

C-x C-s filename 
C-x C-c

You should be back in UNIX. Try:

cat spels.lisp

Can you see the file you created?

Test6: load a file

% emacs spels.lisp

Can you see your file?

Test7: running lisp

M-x slime 

After a little wait, you should be looking at

; SLIME 2007-09-27
CL-USER>

Now type

 (+ 1 2) 

What is 1 + 2?

Test8: loading a file

CL-USER> (load "spels.lisp")
(hello-world)

You should see "hello world"

Test9: all together

At the Unix command line,

% emacs spels.lisp

Then, in emacs

C-x 2
M-x slime
(load "spels.lisp")
(hello-world)

Your screen should look like the following (with you path name in the window title).

Take a screen snap, print it, write your group's name at the top, hand that in.

Part 2: Learning LISP

Recreate the environment of test9. Read the "Casting Spels" book, type in the code into "spels.lisp", and recreate all the output shown in brown text; e.g., on page 10:

(describe-location 'living-room *map*)

==> (YOU ARE IN THE LIVING-ROOM OF A WIZARD'S HOUSE. 
     THERE IS A WIZARD SNORING LOUDLY ON THE COUCH.)

Remember that, to run your code you have to:

Step1 : Pages 1..10

Do not use the on-line Franz Lisp. Instead, use CSEE machines.

Ignore the code

(setf tpl:*print-length* nil)

After you complete Pages 1..10, add this code to the top of spels.lisp. If defines an "(init)" function which resets the game back to some initial state (which is useful for starting all over again, from scratch).

(defparameter *objects* '(whiskey-bottle bucket frog chain))

(defparameter *map* '((living-room (you are in the living-room of a wizard's house. 
				    there is a wizard snoring loudly on the couch.)
                     (west door garden)  
                     (upstairs stairway attic))
              (garden (you are in a beautiful garden. there is a well in front of you.)
                      (east door living-room))
              (attic (you are in the attic of the abandoned house. 
		      there is a giant welding torch in the corner.)
                     (downstairs stairway living-room))))

(defparameter *location* nil)
(defparameter *object-locations* nil)

(defun init ()
  (setf *object-locations* '((whiskey-bottle living-room)
                           (bucket living-room)
                           (chain garden)
                           (frog garden)))
  (setf *location* 'living-room))

(init)

Step2: pages 10..19

Get up to the point where you can pickup a whiskey bottle.

Note, you can stop right here and get full marks form Project 3a.

Step3: pages 19..22

For 2.5 bonus marks, complete the rest of the tutorial.