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 (define/tight (fn args ...)
(define (fn args ...) (fn/impl args ...))
(define/contract (fn/impl args ...)
#:freevar fn ctc ; Directs blame to "fn/impl" rather than the
On Sat, May 6, 2017 at 11:15 AM, Matthias Felleisen <matth...@ccs.neu.edu>
> #lang racket
> (define/contract [unsafe-factorial n]
> (-> (and/c integer? (>=/c 0)) (and/c integer? (>=/c 0)))
> (if (zero? n)
> (* n (factorial (- n 10)))))
> (define (factorial n) (unsafe-factorial n)) ;; cross the boundary and go
> right back in
> (unsafe-factorial 5) ; Does not terminate
> I suspect you can implement this with a macro now.
You received this message because you are subscribed to the Google Groups
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.