On 12/16/13, Pascal J. Bourguignon pjb@informatimago.com wrote:
Theam Yong Chew senatorzergling@gmail.com writes:
I also updated java:jnew-runtime-class's docstring, but I'm not sure if the wording "function designator" is accurate enough, since (funcall '(lambda () 1)) => 1
Would '(lambda () 1) be considered a FUNCTION DESIGNATOR?
CLHS Glossary says:
function designator n. a designator for a function; that is, an object that denotes a function and that is one of: a symbol (denoting the function named by that symbol in the global environment), or a function (denoting itself). The consequences are undefined if a symbol is used as a function designator but it does not have a global definition as a function, or it has a global definition as a macro or a special form. See also extended function designator.
therefore:
(defun function-designator-p (object) (or (symbolp object) (functionp object))) (function-designator-p '(lambda () 1)) --> NIL
So, the answer is no.
-- __Pascal Bourguignon__ http://www.informatimago.com/
Ok, I did see that. I was momentarily confused by ABCL's behaviour, it accepted this,
CL-USER(1): (funcall '(lambda (x) 1) 1) ==> 1
whereas in SBCL: (funcall '(lambda (x) 1) 1) leads to an error.
The value (LAMBDA (X) 1) is not of type (OR FUNCTION SYMBOL). [Condition of type TYPE-ERROR]
Restarts: 0: [ABORT] Exit debugger, returning to top level. ...
After re-reading CLHS (glossary, FUNCALL, APPLY etc), this seems expected. I'm also trying to remember, this seems to that conform to my muscle memory more consistently as well.
I was going to modify my patch to change "FUNCTION designator" -> "FUNCALLable Lisp object" instead, but perhaps ABCL's APPLY needs to be modified instead? Is this non-compliant behaviour?
Yong