A Lisp Applet for Beginning with Lisp
CSE 415: Introduction to Artificial Intelligence
The University of Washington, Seattle, Spring 2002
The applet on this page presents a web-based interpreter for a subset of Common Lisp. To use the applet, type a Lisp expression in the input area at the bottom of the Lisp frame. Only type the Enter key when the cursor is actually at the end of the expression to be entered. The upper part of the frame shows the answers and the previous expressions typed in. If the applet seems to be unresponsive, it may be due to typing in an expression with unbalanced parentheses, unbalanced double quotes, or accidentally deleting the prompt symbol. You can always click the Cancel button to reset the input area.

Supported are symbols representing variables and functions, most special forms such as QUOTE, SETQ, LET, LET*, IF, and the macros COND, DEFUN and DEFMACRO. Some of the most commonly used functions are also implemented. The FORMAT function is provided but only the ~S directive works. The applet also supports closures (using either LAMBDA expressions or the #'function syntax), EVAL and APPLY.
 
An example recursive function is a factorial function:
(defun fact (n) (if (< n 1) 1 (* n (fact (- n 1)))))
Typing in this definition and then (fact 7) illustrates a little of what is possible with the applet.
 
Another example is the following, which applies a local function repeatedly, in each case making a sublist contain the sum and the difference of two corresponding values.
(mapcar #'(lambda (x y) (list (+ x y)(- x y))) '(100 200 300) '(1 2 5))
 

You need a Java plug in for this applet.