CS441 - Homework #2
This
evaluation is based upon the criteria in Chapter 1 of the
text by
Robert Sabesta. My summary of these criteria can be found
here.
Much of my
analysis is based upon the online tutorials
Basic LISP Techniques (.pdf) by David J. Cooper, Jr. which
covers the Common LISP dialect and the
LISP Primer at
Texas A&M University.
Readability
Although the
structure of LISP source code is quite different from the
block-structured languages that most of us are used to from our
foundation programming classes, the language is very readable due
to its "simplicity and consistency".
Basic components in LISP
are either functions or arguments, and function
calls can hold the position of an argument. This small number of
components makes the language easy to read and understand with no
multiplicity or operator overloading allowed. Also, LISP is simple
because ALL functions are in prefix notation - removing any
questions about operator order.
Because the
return value of a function can be used as an argument of another
function, this allows for powerful combinations and orthogonality.
As well, there
are adequate control statements (if, when, cond, case, etc)
without the use of goto statements.
A large amount
of data types are native to CL that usually need to be implemented
with libraries in other languages. These include complex numbers
and ratios as well as the usual integer, floating point, strings,
and arrays.
The syntax aids
in readability by designing statements that indicate their meaning
and not restricting the length of identifiers. Also, all variables
are interpreted in upper case - eliminating the possibility of
different variables with the same name.
However, some
obstacles to readability include (at least to the novice LISP
reader) the overabundance of parentheses used to separate
functions, list arguments, and block controls. Also, my
understanding of later versions of LISP (i.e. - CL) is that a
single LISP statement is broken down into a set of different
syntactic symbols, depending where it sits in the code
statement - and a symbol can have the same name for both a
function and a variable declaration. This, to me, is a
great challenge to readability.
Writability
LISP has very
straightforward rules for organizing code. As noted above, it is
simple and orthogonal. The newer text editors apparently aid the
writer in keeping track of the code blocks separated by parentheses.
LISP includes
support for abstraction with structures and lists - and newer
versions of LISP (CL) include support for Common LISP Object System
(CLOS) for full
object-oriented functionality.
I believe that
LISP is a very expressive language because of its nested and
recursive nature.
This allows for a large amount of computing to be done with a
small amount of code.However, this does require a bit of
rethinking by the programmer.
Reliability
Original LISP
type checking is generally considered undesirable because all
checking was done at run time - LISP was an interpreted language.
Today's Common LISP can produce compiled code, and, thus, have
compile time checking. However, there still does not seem to be
any reason that one could not use a variable name as an integer in
one statement and then assign it as a string in another. They are
both simply atoms that can be processed as a member of a list in
the correct function.
I would say
that LISP does not have very robust exception handling. When using
a LISP interpreter, the process will simply stop and give the reason for
the error.
Aliasing is not
allowed in LISP.
LISP seems very
readable and writable - once you're used to this paradigm.