Introspection Wolfgang Corcoran-Mathe 10 May 2020 23:41 UTC

Re: Marc's response on the "Asking Introspection" thread:

> There is a second way, however, which can also be applied in other
> situations where multiple values occur. What I am thinking of are
> special forms not restricted to boxes (but could be applied to, say,
> the Justs and Rights of SRFI 189 likewise) as follows:
>
> (values->vector <expr>)
> (values-length <expr>)
> (values->list <expr>)
> (values-ref <expr> <index>)
>
> These are expressions defined as syntax (important because Scheme's
> applicative syntax doesn't allow multiple values). When they are
> evaluated, <expr> is evaluated and expected to return values, which
> are then converted to a vector, a list, etc. Moreover, as this is
> syntax, an implementation can expand these forms into the most
> efficient ones.

I really like these forms as a solution to the multiple-value
container introspection issue (which has also appeared with SRFI
189), and as a convenient interface to multiple values, in general.

(Sorry for replying off-thread; I subscribed after the last message
in that thread was sent.)

Regards,

--
Wolfgang Corcoran-Mathe  <xxxxxx@sigwinch.xyz>

"... if I found the right chair to work in, all compositional
problems would become nonexistant." --Morton Feldman