[racket] how to write a contract for indeterminate number of return values

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu Dec 18 14:16:12 EST 2014

That's not currently possible. I think it would make sense to have a
new contract combinator that supported something like that, but I'll
note that you're kind of fighting with the "smooth" optimization paths
in Racket when you do something like that (as compared to simply
returning a list).

Can you maybe give a little more context to help me understand what
you're doing?

Robby


On Thu, Dec 18, 2014 at 1:02 PM, Matthew Butterick <mb at mbtype.com> wrote:
> "If (values range-expr ...) is used as the last sub-form of ->, the function must produce a result for each contract, and each value must match its respective contract." [1]
>
> I understand what this means if you have a fixed number of return values. But how do you write an output contract for an indeterminate number of return values?
>
> Similar to how (listof type?) contract doesn't care how long the list is, I'm trying to write a contract that means "however many values come back, they all need to be integers".
>
>
> [1] http://docs.racket-lang.org/reference/function-contracts.html
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.