About the function eval in common lisp?

First: (CONS T NIL) T is a constant and returns T when evaluated. NIL is also a constant and evaluates to NIL. (CONS T NIL) then returns (T .

NIL), which is shorter written as (T) Second: (CONS A NIL) A is a variable. It is possibly undefined. Evaluating it will lead to an error when A is undefined Third: Now you should think about the third form.

First: (CONS T NIL) T is a constant and returns T when evaluated. NIL is also a constant and evaluates to NIL. (CONS T NIL) then returns (T .

NIL), which is shorter written as (T). Second: (CONS A NIL) A is a variable. It is possibly undefined.

Evaluating it will lead to an error when A is undefined. Third: Now you should think about the third form...

Got it. It's (CONS 'A NIL) which return (A). Thank you very much.

– Yuduo Gao Sep 10 at 14:11.

One more thing that you may want to note is that third form is embedding the symbol A in the list. Usually this is the form which is mostly taught in Lisp books for learning by experimenting on REPL. However in actual programs / functions, you may be using initially more of putting value or list represented by A in the list and not the symbol A.E.g.(setf a 2) (eval (list 'cons a nil)) => (2) A is evaluated before list is evaluated; (eval '(cons 2 nil)) (eval (list 'cons 'a nil)) => (2) A is evaluated when (eval '(cons a nil)) is evaluated (eval (list 'cons ''a nil)) => (A) A does not get evaluated as call is (eval '(cons 'a nil)); 'a is symbol A If you don't do (setf a 2) in the beginning, 1st and 2nd both forms will give error.

This is because when a is evaluated, it is not bounded (i.e. Crudely, it does not have any value associated with it).

Wow, this really opens my eye. Thank you very much. – Yuduo Gao Sep 27 at 18:48.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions