Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why doesn't a LISP defun require a quote before its parameter argument?

Take this function:

(defun sum-greater (x y z)
 (> (+ x y) z))

It's my understanding that in LISP the first element in a list always represents a function to be performed on the subsequent atoms/lists. So why doesn't LISP treat the x in (x y z) as a function to be performed on y and z. Clearly this would not be desirable behavior, but it would be the expected behavior.

Presumably the function that defines defun somehow overrides the standard LISP evaluation of a list? If so, could you detail this?

Thanks

like image 517
Peter Le Bek Avatar asked Nov 16 '10 15:11

Peter Le Bek


1 Answers

IIRC in Common Lisp at least defun is a macro (HyperSpec), meaning it may define any evaluation strategy whatsoever for its arguments.

like image 151
Derrick Turk Avatar answered Sep 20 '22 05:09

Derrick Turk