Can array-ref return (values ...) ? Brad Lucier (19 Feb 2002 16:40 UTC)
Re: Can array-ref return (values ...) ? Jussi Piitulainen (19 Feb 2002 17:20 UTC)
Re: Can array-ref return (values ...) ? Brad Lucier (19 Feb 2002 17:31 UTC)
Re: Can array-ref return (values ...) ? Jussi Piitulainen (19 Feb 2002 19:02 UTC)
Re: Can array-ref return (values ...) ? David Rush (20 Feb 2002 10:14 UTC)
Re: Can array-ref return (values ...) ? Brad Lucier (20 Feb 2002 17:55 UTC)
Re: Can array-ref return (values ...) ? David Rush (20 Feb 2002 18:41 UTC)

Re: Can array-ref return (values ...) ? Jussi Piitulainen 19 Feb 2002 17:20 UTC

Brad Lucier writes:

> I'm trying to put together an implementation of arrays that will
> serve my current purposes.  At one point, I basically wanted
>
> (array-ref a i j k ...)
>
> to return (values ...).
>
> So I looked at this SRFI and it doesn't seem that this is a real
> problem (OK, it would be a problem with array-set!, but perhaps one
> wants read-only arrays without array-set! to be possible.)

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.

If you want something that accesses several elements at one time - is
that a one-dimensional array above? - that would just be another
operation. No problem.

> How pervasively does one want multiple values to insinuate itself
> into the rest of the language?

I wouldn't avoid them when they are appropriate.

One consideration is what you can do with the values. They must be
passed to a procedure, and that either knows their number or turns
them into a list. In the latter case, it might be better to return a
list or an array in the first place.
--
Jussi