Homework 4 Guidelines
Lisp Interpreters
Permitted Macros, Functions, Predicates, and Operators
File Names
Sample Execution
Grading Considerations
Using Submit and Submitting on Time
Lisp Interpreters
The assignments will be graded using
gcl (GNU Common LISP) on the SEASnet machines. You are
welcome to prepare your assignment using any LISP implementation
you wish, but it is your responsibility make sure that your code
runs correctly under gcl on SEASnet.
Permitted Macros, Functions, Predicates, and Operators
The following is a list of the permitted LISP built-ins allowed
for this assignment. If it's not on this list, you may not
include it in your code. +, −, *, /, mod,
=, <, >, <=, >=, abs, and, append, atom, car, cdr
[cadadr, etc.], cond, cons, defun, equal, first, second [third,
etc.], last, length, let, let*, list, listp, max, min, not, nth,
nthcdr, null, numberp, or, quote ['], rest, reverse, stringp,
symbolp, and time.
If you feel that a necessary built-in has been omitted from this
list, please email the TA.
File Names
For Homework 4, you will need to submit
two ASCII text files:
- hw4.lsp — This file should
contain all functions and all commented LISP code. This code
should not contain dribble statements or the bye
command. Everything in this file that is not code must be
protected by the comment character (semicolon ";"). For full
credit, this file must load correctly into gcl without
error.
- hw3.out — This file should contain only the
sample execution of your code. You should include any test cases
provided in the assignment, as well as sufficient cases to
demonstrate correct functionality.
In general, homeworks
will be submitted using names of the form "hwN.lsp" (containing
only your commented LISP code) and "hwN.out" (containing your
sample executions), where N is the number of the homework
assignment.
Sample Execution
For the sample execution, you may use the script command if you wish. For example:[westholme1] script hw4.out
Script started, file is hw4.out
[westholme1] gcl
GCL (GNU Common Lisp) Version(2.3) Mon Mar 13 14:49:55 PST 2000
Licensed under GNU Library General Public License
Contains Enhancements by W. Schelter
>(load "hw4.lsp")
<... run your test cases here ...>
>(bye)
[westholme2] exit
Script done, file is hw4.out
Alternatively, you may use the dribble function within
LISP. dribble can be used to write a LISP session out to
a file. Dribble is invoked by using ( dribble
"output.filename" ) at the LISP prompt.
You may also use any other method that generates a faithful copy
of an exact run of your code on the test cases using gcl
on SEASnet.
Grading Considerations
Your submissions will be graded
on the correctness of the algorithm and the LISP code, the sample
output provided, and the performance of your solution code during
grading. Your submission will also be graded on commenting
and style.
In addition to program correctness and style, the following
standards will be taken into account during grading.
- Correct Filenames
- Assignments must be submitted using the
filenames specified. Filenames are case sensitive.
Submissions using other filenames may be ignored, but will
most likely result in a deduction of points.
- Name/Assignment Header and General Comment
- At the top of each file submitted, there
should be a comment that includes the name, date, and so forth.
;;;;;
;; Name: Your Full Name
;; login: Your SEASnet username
;; ID: Your UCLA Student ID
;; CS161, Lecture 1
;; Homework 4
;; Date: The Date
;;;;;
There should also be a general, overall comment
that discusses in detail the algorithmic approach to the
solutions to each of the problems.
- Function Header Comments
- For each function in the assignment, including any helper
functions that may be allowed, you must write a header
comment. It should include the function name. It must
include the names of the arguments, the data-types and domains
that are acceptable arguments to the function, and the
data-type and range that is the return value. The header
should explain simply in natural language what the function
does.
- Internal Comments
- Each function should have internal comments that explain the
interesting parts of the code. These comments should loosely
relate the code to the general algorithm discussed in the
general comment at the top. For example, comments like
"split the tree in half using split-list and then recursively
apply list2btree to each half". Each part of the code that
does something "interesting" should have some sort of
comment. These comments should be embedded at the point of
the code they describe. They can be brief.
- Meaningful, Intuitive, Non-confusing Variable Names
- Variable names should be consistently determined and
should relate to the values a variable represents. Single
letter variable names should be avoided except in special
cases (the list L, geometric coordinates x and y, etc.). Just
because LISP is case insensitive does not mean that it is
acceptable to alternate between uppercase and lowercase
versions of variable names to represent the same variable.
This is very confusing. Don't do it. Also, avoid using l
(lowercase L) as a variable name; it can be easily confused
for a 1 when reading arithmetic operations. In general,
variables should be named with small words, e.g., Len1, Len2,
elem, L-branch, R-branch, etc.
- Illegal Built-Ins and Extraneous Helper Functions
- Do not use LISP built-ins that are not on the permitted list.
Points will be deducted for using them. Do not write helper
functions for problems that ask you to use a single, pure LISP
function. Points will be deducted for using more functions to
solve a problem than are allowed.
- Code Layout, Indentation, and Spacing
- Please indent your code so that it is easily readable.
Indent using either spaces or tabs, but not a mix of both. A
mix of both can appear completely messed up when viewed on
other machines. Ideally, source code fits in 80 column width.
You should limit each line in your code to no more than
80 column width. Bear in mind that tabs may take up as
many as 8 columns when displayed on some machines, so if you
are unsure, use spaces to indent, rather than tabs.
Using Submit and Submitting on Time
All assignments must be submitted using the
CourseWeb online assignment submission system.
You are still
responsible for using a SEASnet account to test your code.
Remember to use the proper filenames for this assignment.
("hw4.lsp" and "hw4.out"). Also, remember to make sure that you
only submit ASCII text files. If your submission worked
correctly, you should get a message indicating so.
All assignments must be submitted by the specified deadline
according to the clock on CourseWeb. Run the command
telnet courseweb.seas.ucla.edu 13
to get a sense of the
current time on the CourseWeb cluster.
In order to make sure that you submit before the deadline,
feel free to submit partial solutions as often as you like.
CourseWeb will allow you to resubmit the same files repeatedly up
until the deadline. Partial credit will be assigned for partial
solutions. Late submissions will not be accepted.
Last modified: Wed May 3 21:02:27 PDT 2006