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

Re: Can array-ref return (values ...) ?

This page is part of the web mail archives of SRFI 25 from before July 7th, 2015. The new archives for SRFI 25 contain all messages, not just those from before July 7th, 2015.

Brad Lucier <lucier@xxxxxxxxxxxxxxx> writes:
> > Brad Lucier <lucier@xxxxxxxxxxxxxxx> writes:
> > > > I don't understand. Array-ref by me returns the contents of a single
> > > > element, so that would be just (values v) which is just v.
> > > 
> > > Yes, it returns the contents of a single element, but what are the contents
> > > of a single element?  ...  Can it be
> > > (values a b)?  If not, why not?  
> > 
> > No. Because (values ...) is not a data constructor. It is a special
> > syntax that explicitly applies its arguments to the current
> > continuation [see the recent messages on cls under the TCO thread].
> In R5RS, (values ...) is a procedure.

Ok, it's a procedure that accesses the current continuation
then. It is a very odd procedure in since it can only be called in
tail position. It *still* does not construct a data object, so it
cannot be the "contents" of an array element. IOW,

        (vector-set! v n (values 4 3 2))

is completely meaningless. Therefore the contents of a single element
cannot be (values a b).

> > > And if not, perhaps it should be
> > > documented to be not possible.
> > 
> > OK. Except that it's really not possible because of R5RS.

> R5RS has nothing at all to say about arrays (or many other things).
> So we are free to use our imagination, if we wish.

But it has lots to say about tail calls and continuations. VALUES is a
continuation operator, not a data constructor.

david rush
Scheme: Because continuations are freaky.
	-- Anton van Straaten (the Scheme Marketing Dept from c.l.s)