[CSUSB]
>> [CNS]
>> [Comp Sci Dept]
>> [R J Botting]
>> [CSci620]
>>
lab16
[Source]
[Index]
[Schedule]
[Syllabi]
[Text]
[Labs]
[Projects]
[Resources]
[Search]
[Grading]
Notes:
[01]
[02]
[03]
[04]
[05]
[06]
[07]
[08]
[09]
[10]
[11]
[12]
[13]
[14]
[15]
[16]
[17]
[18]
[19]
[20]
Thu May 20 16:23:13 PDT 2004
Contents
CS620 LISP Laboratory Number 3
Check out New things on the Course Web Page
[ http://www.csci.csusb.edu/dick/cs620/ ]
Goal
This lab should teach you how to create and use
new functions that manipulate lists.
You should record your insights and confusions
in a page or two of notes.
Let me know by
calling me across to your workstation when done.
To earn full credit the work must be done before the end of the lab.
Required Work
Use a text editor and the XLISP system to develop
a working version of the meta-interpreter
in the text.
Work in pairs of one, two, or three people at on machine.
It is best if one person has the book and dictates the code,
one person types, and the third person (if any) takes notes and
comments on what is going on. Change roles very now and then.
Notes
- If the book has (equal ......) do not type (= .....). '=' is for numbers only.
- The only known error is in the last branch of evunconds, line 3 on page 192: (t eval body) should be (t (eval body)).
Deliverables
A page of notes (WWW, online, offline) on the functions in
the last part of the LISP chapter.
Include what you have learned by coding and debugging them.
Hints
- Keep your handout and notes on LISP open beside you and look in it for
the rules of LISP.
- Use the online resources:
[ lisp.html ]
[ lisp.txt ]
[ lisp.functions.html ]
[ functions.lsp ]
- Use an editor to write the function definitions in a file
with extension ".lsp".
- Do it one function at a time!
- Be very very careful about counting parentheses.
- 'vi' can help you track parentheses if you do the following in 'vi'
:set showmatch
- Use an editor to write your functions and their test cases then either
- Copy and paste into a window running XLisp to run them...
- or
- Save the version ( :w in vi) and run xlisp on it. (:!xlisp % in vi)
Look at the source code for XLISP
[ http://www.csci.csusb.edu/dick/cs320/lisp/src/ ]
To Leave LISP
To exit lisp, input the EOT character CTRL/D
. . . . . . . . . ( end of section CS620 LISP Laboratory Number 2) <<Contents | Index>>
Dirty LISP
It is possible to write LISP code that is full of
loops and the equivalent of {...} and assignments.
The key operators are: PROG, PROGN, DO, DO*,...
You should resist the temptation to use these since
your task is to learn functional thinking... which
avoids these concepts.
In more advanced classes you may use (LET ....) and (LET* ....)
to avoid an intermediate function.
Glossary
BNF::="Backus-Naur Form", for syntax and grammar, developed by Backus and Naur.
EBNF::="Extended " BNF.
HTML::= "HyperText Markup Language", used on the WWW.
HTML_page::syntax= "<HTML>" head body.
Java::="An " OO " Language from Sun".
LISP::= "LISt Processing Language".
LRM::="Language Reference Manual".
OO::="Object-Oriented".
Prolog::="Programming in Logic".
TBA::="To Be Announced".
UML::="Unified Modeling Language".
URL::=Universal_Resource_Locator,
Universal_Resource_Locator::syntax= protocol ":" location, where
Net
- protocol::= "http" | "ftp" | "mailto" | ... ,
- location::= O( "//" host) O(pathname).
(End of Net)
WWW::= See http://www.csci.csusb.edu/dick/cs620/,
index to web site for this class.
XBNF::="eXtreme" BNF, developed by the teacher from EBNF, designed
to ASCII input of syntax, semantics, and other formal specifications.
Formulae and Definitions in Alphabetical Order