I want to be able to read a lambda expression from the keyboard. For example, if a function square has already been DEFUNed I can enter the symbol name:
(defun square (x) (* x x))
so that when the following is evaluated:
(funcall (read) 2)
the user can type square
and the result is 4. But if the user types
(lambda (x) (* x x))
the result is an error, for example in Macintosh Common Lisp,
Error: (LAMBDA (X) (* X X)) can't be FUNCALLed or APPLYed
Is there an easy way to do this I am missing?
Thanks.