Barry Margolin
5/20/2016 10:32:00 PM
In article <20160520123003.235@kylheku.com>,
Kaz Kylheku <545-066-4921@kylheku.com> wrote:
> On 2016-05-20, Jim Newton <jimka.issy@gmail.com> wrote:
> > On Friday, May 20, 2016 at 6:15:06 PM UTC+2, Rob Warnock wrote:
> >
> >>
> >> VALUES is just an ordinary[1] function, not a macro or
> >> a special form. As long as the list given to it is less
> >> than CALL-ARGUMENTS-LIMIT long, why *shouldn't* it work?!?
> >>
> >>
> >
> >
> > Well I though VALUES was the special form which actually triggered multiple
> > values.
>
> Internally, the values function has to rely on some such a thing, of
> course:
>
> (defun values (&rest args)
> (sys:somehow-construct-multiple-values-on-stack args))
>
> A decent Lisp compiler has to inline this; you don't want to be
> actually branching to some other function just to establish the return
> values of your own (or that it doesn't have any).
It might even be something like this:
(defun values (&rest args)
(values-list args))
(defun values-list (values)
(values-list values))
The second function looks like infinite recursion, but it's not because
the compiler open-codes the inner call.
I remember once looking at the source code for a Symbolics Lisp Machine,
it's full of code like that:
(defun cons (car cdr)
(cons car cdr))
(defun car (cons)
(car cons))
(defun cdr (cons)
(cdr cons))
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***