Question: Read an expression, transform it, and print the result. ( 1 oop (print prompt (print (funcall transformer (read))))) This function could then be used in
"Read an expression, transform it, and print the result."
( 1 oop
(print prompt
(print (funcall transformer (read)))))
This function could then be used in writing each new interpreter:
(defun lisp 0
(interactive-interpreter '> #'eval))
(defun eliza 0
(interactive-interpreter 'eliza>
#'(lambda (x) (flatten (use-eliza-rules x)))))
Or, with the help of the higher-order function compose:
(defun compose (f g)
"Return the function that computes (f (g XI)."
#'(lambda (x) (funcall f (funcall g x))))
(defun eliza 0
(interactive-interpreter 'eliza>
(compose #'flatten #'use-eliza-rules)))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
