Introduction to the Lab Environment and Common Lisp
Laboratory Exercise 1
810:161
Artificial Intelligence Laboratory
[ Goals |
Background |
Pre-Lab |
In-Lab |
Post-Lab |
More Info ]
Goals for the Laboratory Exercise
The goal of this lab is to introduce you to the tools you will be using
this semester. You will begin to become acquainted with your Common Lisp
environment and whatever development environment you choose. You will
reacquaint yourselves with the World Wide Web and with Unix mail. A
secondary goal of the lab is to introduce the format of the sessions and
exercises for this laboratory.
Background
We will use a common format for each of our sessions this semester and for
each of the exercises you do, one per session.
Session Format
Each week's lab will work something like this:
- The laboratory exercise for the week will usually be made available
on the web by Wednesday afternoon. You should read the entire
document and perform any pre-lab activity that it describes before
beginning on the main task of the lab. Submit any pre-lab work as
directed.
- You can use visits to my office hours, e-mail to
the lab mailing list or to
me, or chance encounters in
the hallway to ask you any questions you have about the material or
the assignment. I will send e-mail to answer common problems and to
address any administrative issues you raise.
- For the remainder of the week, you will work on the assigned lab
activity. I will continue to be available for assistance. Feel free
to pull me into the lab and ask questions. Feel free to stop by my
office. And don't be surprised if I invite myself to your work
station to discuss the lab and review your work.
- Submit your work as directed. Usually, you will have until 4:00 PM
of the next Wednesday to submit your work. But make sure that
you read the assignment early and watch for any special dates,
including early submission dates.
Document Format
All of the exercises that you perform in this laboratory will be presented
in the same format as this one. Each document consists of five sections,
with an optional sixth.
- The first describes the goals for the exercise. Pay attention to the
issues highlighted in this section as you complete the exercise.
- The second provides background material for the exercise. Sometimes,
this consists of material that you need to know to do the lab, but
which has not been covered in assigned readings. At other times, it
consists of one-time-only instructions or reminders from previous
labs.
- The third lists all pre-lab activities that you must do before
beginning the lab exercise of the session. Often this includes
reading from the text and/or code to read or write.
- The fourth consists of the in-lab activity itself.
- The fifth describes any post-lab activities that you are to do.
Usually, this will code to write or analysis of execution results.
- The sixth provides ideas and pointers for further exploration of the
lab topic. Activities described in this section will never be
required, but you are encouraged to explore in more detail whenever
you feel a need to understand a topic better, whenever you are
especially interested in a topic, or whenever you just have some time
and would like to become a better AI programmer.
Using E-Mail and Computing Resources
We will do much of our communication for the lab by World Wide Web and by
e-mail this semester. If you would like to send your mail from one of
our Linux stations but have never used mail on a Unix system before, see
the CNS Unix User Guide.
Whenever you send me an e-mail message, but especially when you are
submitting an assignment via e-mail, be sure to...
- Use a Subject: line that includes the course number. I
will be able to provide better response times if I am able to
determine the content of your message without reading it. A good
habit to use is to prefix your subjects with "[161] ".
- If you are sending a question, be sure that your Subject:
line says so. Using the word "Question" or the punctuation mark "?"
in the subject are ways to do this.
- If you are submitting your assignment, be sure that your
Subject: line says so. Ending the subject with the word
"Solution" is a way to do this.
- Use my full address, wallingf@cs.uni.edu.
- cc: yourself. Your copy is time-stamped proof of
submission and serves as a backup in case the system loses your
message (or I do!).
- Be sure that the body of message that contains a solution
that you're turning in contain only your Common Lisp code as
text.
Attachments come encoded in crazy formats sometimes, and I read
my mail from many different places. Text in the body of a message
is always readable, and it is easy for me to save to a file, load
into my Lisp environment, and run.
Pre-Lab Activities
Prior to doing the in-lab activity, be sure that you have done the
following:
- Read this document in its entirety.
- Read Chapters 1-2 in
ANSI Common Lisp.
- Access your account on cowboy. See me if you don't have one.
In-Lab Activities
Start up your Common Lisp environment. If you are working on your own
machine or on another machine outside of CNS, then I won't be able to
tell you exactly what to do. I might be able to answer your questions,
though.
If you are working on one of the Linux boxes in CNS, especially in Wright
Hall, then I can help you get started. If you have never used the work
stations in this lab before, ask me for some help getting started. You
should plan to spend some extra time in the lab during the first week
becoming familiar with Linux, its windowing system, a mail tool, and
an editor.
Whenever you are instructed to "enter" something below, type the text
indicated and hit the Return key. If the indicated text is ever
inside quotation marks, do not type the quotes themselves.
- Describe what happens when each of the following expressions is
evaluated. Record the results each as a part of your answer.
- (+ (- 5 1) (+ 3 7))
- (1+ 3 8)
- (8 + 3)
- (list 1 (+ 2 3))
- What does this function do?
(defun enigma (x)
(and (not (null x))
(or (null (car x))
(enigma (cdr x)))
))
- What could occur in place of the X in each of the following exchanges?
> (car (X (cdr '(a (b c) d))))
B
> (X 13 (/ 1 0))
13
- Use car and cdr to define a function that returns
the fourth element in a list. Assume that the list has at least four
elements.
- Extend your function from Problem 4 so that it works for lists
with fewer than four elements.
In-Lab Deliverables
By 4:00 PM on the due date, submit:
- a text file that contains your answers to Problems 1-3 and your
code for Problems 4-5, hard copy
- the same file, by e-mail
Post-Lab Exercise
Play some more with Lisp. Feel free to read ahead in the textbook and to
study its code examples in more detail. I'd especially recommend that you
spend some time in front of your Lisp interpreter while studying the text.
You can't read a book on a programming language the way you read a novel!
Identify:
- at least one question that you have about Common Lisp at this point,
and
- at least one question that you have about your Common Lisp environment
at this point.
This exercise is serious. I've been programming in Common Lisp
for a long, long time, and I still have real questions about the language.
I expect that all of you learning the language have real questions about
the language, too. Likewise, I've haven't told you much about gcl
as an interpreter, so I expect that all of you learning it for the first
time have real questions about what you can and can't do with it.
Send me your questions via e-mail by 4:00 PM on the due date.
Further Information
As mentioned in the syllabus, there are a
number of Lisp and Common Lisp references available to you, on reserve at
the library and through me. Go over to the library and peruse these books.
You'll find it useful to become familiar with these books so that, when
questions arise later, you can find answers promptly.
Many Common Lisp systems provide help Common Lisp functions and features as
they are implemented in the system. For example, gcl offers
full on-line documentation of all built-in functions, macros, variables,
constants, types, and special forms via its help facility:
(help any-symbol)
Find out what your environment others.
Eugene Wallingford ====
wallingf@cs.uni.edu ====
August 29, 2001