| > None of the assignments my classmate struggled with required him write code that processes code That's not what I meant. What Lisp with s-expressions already makes more difficult is that the data syntax is used to express programs. (defun foo (list1 list2)
(quote (defun foo (list1 list2) (list list1 list2))))
-> A symbol can be an identifier and just a piece of data.Above, the first DEFUN is a standard identifier of the programming language Common Lisp. The second DEFUN is just a symbol. The first DEFUN form is a program. The second DEFUN expression is just data. Thus it makes no sense to indent the second DEFUN expression like a program. We don't know if it is a program, it could be just anything. -> A list can be data and a program. This specific double nature of built-in data structures, here symbols and lists, is already a hurdle to get over. The developer has to know which lists are data lists, which are forms and which are expressions in inside a form. (cond ((quote (a))))
-> (cond ((quote (a)))) is a form, which is meant to be evaluated
(a) is data
((quote (a))) is a clause of COND, which is neither data, nor a form to be evaluated
Thus the user has to understand that in Lisp these lists serve different purposes. Which is which depends on the context and the Lisp syntax & evaluation rules.This then even may make functions possible which contain their own definition as data: CL-USER 9 > #1=(defun foo (list1 list2)
(quote #1#))
FOO
CL-USER 10 > (foo '(1) '(2))
#1=(DEFUN FOO (LIST1 LIST2) (QUOTE #1#))
|