[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: elisp test case question

From: Neil Jerram
Subject: Re: elisp test case question
Date: 03 Mar 2002 22:00:27 +0000
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

>>>>> "Dirk" == Dirk Herrmann <address@hidden> writes:

    Dirk> Hi folks,
    Dirk> I wonder if the following test case in the elisp test suite is OK:

    Dirk> Tested expression:
    Dirk> (eval-elisp '(apply (lambda (x y &optional o &rest r) (list x y o r)) 
1 2 3 nil))
    Dirk> expected result in the test case (which it actually gives):
    Dirk> (1 2 3 #nil)
    Dirk> but shouldn't this rather be:
    Dirk> (1 2 3 (#nil))
    Dirk> ?

No.  The answer that you suggest would be correct for `funcall'
instead of `apply'.  For `apply', the final `nil' means that there are
no more arguments after 1, 2 and 3.

In support of this, here's what Emacs's Lisp Interaction mode says:

(apply (lambda (x y &optional o &rest r) (list x y o r)) 1 2 3 nil)
(1 2 3 nil)
(funcall (lambda (x y &optional o &rest r) (list x y o r)) 1 2 3 nil)
(1 2 3 (nil))

    Dirk> If not, how could one distinguish the result from
    Dirk> (eval-elisp '(apply (lambda (x y &optional o &rest r) (list x y o r)) 
1 2 3))
    Dirk> ?

I would expect this to signal an error, as `3' is not a list.  In
Emacs, it does: `Wrong type argument: listp, 3'.  I'm currently
working on the stable branch, so I can't conveniently check what Guile
would say for this one.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]