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

2017-05-06 Thread Daniel Prager
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/contract (greater-than-square? x [y 0]) (->i ([x real?]) ([y real?]) [result boolean?] #:post (x y

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

2017-05-06 Thread Matthias Felleisen
I did #1681. The region one is arguably correct. > On May 6, 2017, at 6:36 PM, Dupéron Georges > wrote: > > Le dimanche 7 mai 2017 00:27:36 UTC+2, Daniel Prager a écrit : >> Thanks Georges >> >> It looks suggestive, but I'm struggling to follow the details

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

2017-05-06 Thread Dupéron Georges
Le dimanche 7 mai 2017 00:27:36 UTC+2, Daniel Prager a écrit : > Thanks Georges > > It looks suggestive, but I'm struggling to follow the details of > with-contract / blame-id. An example of use would be very helpful in the docs! This gives "blaming: (region unsafe-factorial)" instead of

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

2017-05-06 Thread Matthias Felleisen
Those who look shall be rewarded: (define unsafe-factorial (invariant-assertion (-> (and/c integer? (>=/c 0)) (and/c integer? (>=/c 0))) (lambda (n) (if (zero? n) 1 (* n (unsafe-factorial (- n 10))) (unsafe-factorial 5) BUT @robby the invariant-assertion

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

2017-05-06 Thread Daniel Prager
Thanks Georges It looks suggestive, but I'm struggling to follow the details of with-contract / blame-id. An example of use would be very helpful in the docs! Have you used this construct? Dan On Sun, May 7, 2017 at 7:44 AM, Dupéron Georges wrote: > Le samedi

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

2017-05-06 Thread Dupéron Georges
Le samedi 6 mai 2017 23:38:29 UTC+2, Daniel Prager a écrit : > Although I understand why my macro does this > > unsafe-factorial: contract violation > ... > blaming: (function fn/impl) > ... > at: unsaved-editor:13.15 > > > Ideally I would prefer one which blames unsafe-factorial > >

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

2017-05-06 Thread Daniel Prager
Although I understand why my macro does this unsafe-factorial: contract violation ... blaming: (function fn/impl) ... at: unsaved-editor:13.15 Ideally I would prefer one which blames unsafe-factorial unsafe-factorial: contract violation ... blaming: (function unsafe-factorial) ... at:

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

2017-05-06 Thread Matthias Felleisen
> On May 5, 2017, at 11:30 PM, Daniel Prager wrote: > > Thank-you Matthias > > That's neat! > > And yes, I can write a basic macro. By introducing #:freevar I was able to > improve the blame situation, but the abstraction is a bit leaky ... > > (define-syntax-rule