--
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CABefVgxaHsLkTwGrqPXJ3xonVw4iuzhNMLGcge1qouUT0aqccw%40mail.gmail.com.
On 5/27/2020 6:34 AM, Jens Axel Søgaard wrote:
>
> In standard Racket an application doesn't communicate how many values
> a function is expected to produce.
You can ask: see procedure-result-arity
https://docs.racket-lang.org/reference/procedures.html
> I have written a small proof-of-concept of an assignment operator :=
> that communicates to a function how many extra values it is expected
> to produce (and still works with standard functions).
>
> Are there alternative solutions that are better than the "use a
> keyword" approach?
You can use call-with-values which connects the function that produces
with the one that consumes, but they have to agree on the number of
values being passed or it won't work.
Den ons. 27. maj 2020 kl. 19.27 skrev George Neuner <gneu...@comcast.net>:
On 5/27/2020 6:34 AM, Jens Axel Søgaard wrote:
>
> In standard Racket an application doesn't communicate how many values
> a function is expected to produce.
You can ask: see procedure-result-arity
https://docs.racket-lang.org/reference/procedures.html
I think procedure-result-arity answers the question "how many
values could this procedure return?" and not "how many values
is the procedure expected to return in this context?".
> I have written a small proof-of-concept of an assignment operator :=
> that communicates to a function how many extra values it is expected
> to produce (and still works with standard functions).
>
> Are there alternative solutions that are better than the "use a
> keyword" approach?
You can use call-with-values which connects the function that produces
with the one that consumes, but they have to agree on the number of
values being passed or it won't work.
My problem is that the producer still needs to be told how many values to produce.