Mostly I was curious if there were an approved way of doing this. The need is not urgent.
I have a function that returns a list of lists, and its output contract is (listof list?). I was making a variant of it that returned values rather than a list (by just doing (apply values ...) to the original function result). So I wanted to update the output contract accordingly. On Thu, Dec 18, 2014 at 11:16 AM, Robby Findler <[email protected] > wrote: > > 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 <[email protected]> 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 >
____________________ Racket Users list: http://lists.racket-lang.org/users

