Advanced Placement Computer Science AB:
Assignment 31:  Lists and Lisp
   Sewickley Academy, 2000-2001

See Course Home Page.
 
Date Assigned: Thu Feb-1
Date Due: Mon Feb-5


For this assignment, you will need to install XLisp from xlisp21w.zip.   You should play around with XLisp for now (as the full assignment will not be available until Friday evening, but any work you do with XLisp now will aid in the assignment).  A simple web search on "Lisp tutorial" produces scores of fine online tutorials, such as the following (only briefly screened) examples:

http://grimpeur.tamu.edu/~colin/lp/lp.html
http://www.cs.unm.edu/CS_Dept/faculty/homepage/luger/cs451/lisp/tutorial.html
http://psg.com/~dlamkins/sl/html/chapter03.html
You can surely use these or find other suitable tutorials with little effort.

In any case, at least try the following, and some variants on these themes:

(setq x 10)
(setq y 20)
(setq z (+ x y (* x y)))
(defun square(x) (* x x))
(setq z (square y))
(defun fib(n)
  (if (< n 2)
      1
      (+ (fib (- n 1))
         (fib (- n 2)))))
(setq z (fib 5))

(setq a '(this is a list))
(setq b (car a))
(setq b (first a))
(setq c (cdr a))
(setq c (rest a))
(setf (car c) 'be)
a
c
(member 'list a)

Look for the complete assignment by tomorrow (Friday) evening.  Have a great weekend!

DK



See Course Home Page.