[plt-scheme] Problem with macro generated provide/contract

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Nov 6 08:37:37 EST 2005

At Sun, 06 Nov 2005 13:04:14 +0100, Jens Axel Søgaard wrote:
>    (define-syntax provide-list-operations-with-contracts
>      (syntax-rules ()
>        [(provide-list-operations-with-contracts)
>         (begin
>           (require (lib "contract.ss"))
>           (define pair/c (flat-named-contract 'pair pair?))
>           (define-syntax (provide-list-operations stx)
>             (syntax-case stx ()
>               [(_)
>                (with-syntax
>                   ([mycons  (datum->syntax-object stx 'mycons)]
>                    [mycar   (datum->syntax-object stx 'mycar)]
>                    [myempty (datum->syntax-object stx 'myempty)])
>                   #'(provide/contract
>                      (mycons (-> any/c any/c  pair/c))
>                      (mycar  (-> pair/c  any/c))))])))])))

Did you mean

(module list-signature-with-contracts mzscheme
   (provide provide-list-operations-with-contracts)
   (define-syntax (provide-list-operations-with-contracts stx)
     (syntax-case stx ()
       [(provide-list-operations-with-contracts)
	(with-syntax
	    ([mycons  (datum->syntax-object stx 'mycons)]
	     [mycar   (datum->syntax-object stx 'mycar)]
	     [myempty (datum->syntax-object stx 'myempty)])
	  #'(begin
	      (require (lib "contract.ss"))
	      (define pair/c (flat-named-contract 'pair pair?))
	      (provide/contract
	       (mycons (-> any/c any/c  pair/c))
	       (mycar  (-> pair/c  any/c)))))])))

?

Matthew



Posted on the users mailing list.