The goal of this lab is to expose you to more of the vast landscape of Common Lisp and to give you one more week of practice with the language mostly outside the context of an AI program.
"No doubt about it. Common Lisp is a big language." So writes Guy Steele, the foremost authority on the language you are learning. Even if you don't believe him yet, you will by the time you reach the end of this course. Common Lisp is the ultimate "power" language, because it provides tools specialized to nearly any task that you can imagine. The trade-off is this: On the positive side, you can implement incredibly powerful programs with relatively little code by taking advantage of Lisp's built-in functions. On the negative side, in order to do so you need to know about a staggering number of built-in functions, special forms, macros, keyword parameters, ....
Our goal in this lab is to study AI programming. Common Lisp is for us a means to that end, not an end in itself. While we are moving at a brisk pace, the approach suits our purposes well. The first four labs introduce the Common Lisp landscape briefly, so that you will have a point of reference when reading programs later, and then moves right into AI programming.
You will want to treat the chapters you read as mini-manuals. Read them for familiarity with -- not deep understanding of -- each topic, and plan to return to the chapter for closer study when you encounter a program or function later in the course.
Prior to doing the in-lab activity, be sure that you have done the following:
Submit by the end of the day Monday an e-mail message that contains answers to the following questions:
Define a function named find-most-wins that takes a list of symbols as an argument and returns a pair as its output. The symbols in the input should correspond to teams and should have win-loss data attached to their property lists. For example:
* (find-most-wins '(chicago miami newyork atlanta)) (CHICAGO 69)
... where 69 is the number of wins associated with 'chicago.
* (symbol-print 'foo) VALUE: (A B C) FUNCTION: (LAMBDA-BLOCK FOO (X) (LIST X)) PROPERTY COLOR = RED PROPERTY AGE = 32 T
... where T is the function's value.
Compare the output of your function to the output of the function describe, which is a built-in function whose output is implementation-specific.
* (setf within-half-p (tolerance-tester 0.5)) * (funcall within-half-p 1.2 1.4) T * (funcall within-half-p 1.2 2.2) NIL * (setf (symbol-function 'within-half-p) (tolerance-tester 0.5)) * (within-half-p 1.2 1.4)) T * (within-half-p 1.2 2.2) NIL
Submit an e-mail message (whose Subject: line includes ) containing only a single, gcl-loadable file containing your solutions to the above exercises by 4:00 PM on Wednesday, September 26. If you forget what "gcl-loadable" means, please review the instructions in Laboratory Exercise 2.
By that same time, submit a print-out of the same file, to me in person or to the department office.
If you have comments or questions that you would like to send accompanying your submission, please send a separate message.
You have read quite a bit now about lambda and various function-manipulating functions.
Sketch out a function (search operators start-state goal-test search-strategy) that implements the generic systematic search strategy that we first studied in Session 4. The goal-test and search-strategy should be functions.
I say "sketch" because I don't expect that you will have a function that is guaranteed to work, if only because we have defined what states and operators look like yet! But your function should load.
Send to me via e-mail your Common Lisp implementation of search as a gcl-loadable file. Your message should reach me by 4:00 PM on Wednesday.
Moving this quickly into Common Lisp runs the risk of overwhelming even prepared readers. May I suggest that you supplement your study throughout the semester with frequent references to the texts I have on reserve at the library? As noted earlier, I have in my office a number of Common Lisp texts, including the "bible" (Common Lisp: The Language) and the "dictionary" (Common Lisp: The Reference). The on-line bible is quite a nice service to have free on-line.
Of course, you can stop by my office if you'd like to browse these books, or send me e-mail, if you ever have a question about a Common Lisp construct, or if you want to find out whether Common Lisp has a built-in function to do what you want to do!