Do you want something like this : #lang racket
(define-syntax-rule (lambda/contract (x ...) c e0 e ...) ;; ==> (let () (define/contract (f x ...) c e0 e ...) f)) ;; ----------------------------------------------------------------------------- (define g (lambda/contract (x) (integer? . -> . integer?) (* pi x))) (void (= (g 0) 0)) (with-handlers ([exn:fail:contract? void]) (g 1)) On Nov 13, 2013, at 1:12 PM, Matthew Butterick <m...@mbtype.com> wrote: > Having gotten in the habit of writing function contracts, I prefer > define/contract to (provide (contract-out ...)) because it keeps the contract > near the function. > > Is there an analogous idiom for lambda? I see there is no lambda/contract, > and the docs on contracts for case-lambda [1] uses the (provide (contract-out > ...)) style. > > [1] > http://docs.racket-lang.org/guide/contracts-general-functions.html#(part._contracts-case-lambda) > ____________________ > Racket Users list: > http://lists.racket-lang.org/users ____________________ Racket Users list: http://lists.racket-lang.org/users