Re: [racket-users] Apropos contracts: simple predicates and switching on and off

2017-05-07 Thread Dupéron Georges
Le dimanche 7 mai 2017 07:27:08 UTC+2, Daniel Prager a écrit : > 1. Default argument goes missing from post-condition, leading to an > unexpected error ... You should use unsupplied-arg? . But I couldn't find a way to get the default value from the contract. I would guess that the problem is

Re: [racket-users] Apropos contracts: simple predicates and switching on and off

2017-05-07 Thread Daniel Prager
On Mon, May 8, 2017 at 3:05 AM, Matthias Felleisen wrote: > > Measure with outer contract and remove the inner define/tight. If you > wrote this algorithm with a loop in Eiffel, instead of a tail-recursive > function, you wouldn’t check the invariant for every loop

Re: [racket-users] Apropos contracts: simple predicates and switching on and off

2017-05-07 Thread Dupéron Georges
Le dimanche 7 mai 2017 23:14:17 UTC+2, Daniel Prager a écrit : > Thanks for the explanation on 2. Pragmatically, it's just another contributor > to the cost of contract checking. I suppose you meant point 3, instead of point 2? The thread I linked to indicates that with ->d, the double-checking

Re: [racket-users] Apropos contracts: simple predicates and switching on and off

2017-05-07 Thread Philip McGrath
I was also surprised by the-unsupplied-arg ( http://docs.racket-lang.org/reference/function-contracts.html#%28def._%28%28lib._racket%2Fcontract%2Fbase..rkt%29._the-unsupplied-arg%29%29) when I first encountered it: perhaps it should not be the very last thing in the documentation for ->i? If

Re: [racket-users] Apropos contracts: simple predicates and switching on and off

2017-05-07 Thread Matthias Felleisen
> On May 7, 2017, at 1:26 AM, Daniel Prager wrote: > > Putting this new set-up through its paces I think I've found a few issues: > > 1. Default argument goes missing from post-condition, leading to an > unexpected error … (define (default-y x) 0) (define/contract

Re: [racket-users] Apropos contracts: simple predicates and switching on and off

2017-05-07 Thread Daniel Prager
Hi Georges Thanks for the explanation on 2. Pragmatically, it's just another contributor to the cost of contract checking. On 1, I'm (naïvely) baffled as to why the contract should regard an optional argument as unsupplied when it comes from the default rather than an explicit passing. GIven

Re: [racket-users] Apropos contracts: simple predicates and switching on and off

2017-05-07 Thread Daniel Prager
Thanks Georges, Matthias, and Philip for the further pointers: Helped by your comments I inferred that I could construct a legitimate unsupplied-arg case using case-lambda. I think that this is the kind of illustration would be helpful in the docs: #lang racket (module server racket