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.

You can use a Rest argument in the consumer if the values from the producer are put into a list.


Unfortunately, Scheme did not embrace the idea of using tuples for return values, nor did it allow to catch only the first N values as was permitted by Lisp.

George

--
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/fefd28d4-bab8-11bc-0a29-0983758cd454%40comcast.net.

Reply via email to