CSC 330 Lecture Notes Week 9
More on Functional Programming and Lisp
; This is an "x" version of Lisp's read-eval-print loop. When the function ; read-xeval-print-loop is run, it will interactively input expr's from ; the terminal and hand them over to xeval. Note that memory is defined as ; a prog var, that is sent automatically as a parameter to xeval. ; (defun read-xeval-print-loop () (prog (memory result) (setq memory '(nil)) loop (princ "X>") (setq result (xeval (read) memory)) (princ (car result)) (setq memory (cadr result)) (terpri)(terpri) (go loop) ) )
(computed-value-of-expr possibly-updated-memory)
( name value )
( var-name data-value )
( function-name formal-parms function-body )
and these bindings are added to the end of the memory.( pi ai )