[plt-scheme] low-level contract constructors

From: Dave Herman (dherman at ccs.neu.edu)
Date: Tue Sep 9 09:23:00 EDT 2008

In parameter.plt I have a struct-as-procedure called a pseudo-parameter 
with a high-order contract constructor pseudo-parameter/c. I discovered 
a couple little issues with the scheme/contract library in the process.

- The undocumented `proj-get' procedure seems necessary for a 
higher-order contract constructor, since you need to use the projection 
of the underlying contract in building the new one.

- The `flat-proj' procedure isn't exported from scheme/contract, but 
it's also needed for a higher-order contract, in case the underlying 
contract is flat. So I copied its definition from contract-guts.ss and 
pasted it into my module.

Robby, if by chance you have a moment, could you take a look at


and tell me if pseudo-parameter/c looks plausible? It seems to work for 
the test cases I've tried, but it's a little confusing so I'm not sure 
I've got it right. Particularly the call to ((proj-get c) c) looks 
weird. Also, I seem to be getting the object-name wrong when wrapping a 
function contract, e.g.:

     (module a scheme
       (require (planet dherman/parameter:1:3))
       (define p
         (let ([f add1])
             (lambda () f)
             (lambda (g)
               (set! f g)))))
       (provide/contract [p (pseudo-parameter/c (-> number? number?))]))

     > (require 'a)
     > (p)

Thanks so much,

Posted on the users mailing list.