[racket] Unexpected procedure identity

From: Markku Rontu (markku.rontu at iki.fi)
Date: Thu Sep 16 08:05:33 EDT 2010

I'm continuing with define/contract a bit. Let's say there are two
definitions like this

#lang racket

(define/contract (sum/c lon)
  ((listof number?) . -> . number?)
  (sum lon))

(define (sum lon)
  (if (empty? lon)
      (+ (first lon)
         (sum (rest lon)))))

> (has-contract? sum/c)
> (has-contract? sum)

Is there a way to get to what is protected by the contract? I can figure out
that the procedure sum/c is protected by a contract with has-contract? but I
would like to get the wrapped procedure (unprotected sum/c) out in that
case. Perhaps that would be suitable for identity purposes? Or let's say the
blame object in case the procedure is to blame?

I couldn't find anything from the documentation about this.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100916/2e6bb4bb/attachment.html>

Posted on the users mailing list.