[racket] define-struct/contract

From: Stephen Bloch (sbloch at adelphi.edu)
Date: Mon Sep 6 21:56:46 EDT 2010

I'm not sure if this is a bug or if I'm just misunderstanding something.

(define-struct/contract myposn
  ((x number?) (y number?))

(make-myposn 3 4) ; works as I would expect

(make-myposn 3 "hello")
#%htdp: '#%htdp broke the contract 
  (-> number? number? symbol? any)
 on make-myposn given to (struct myposn); expected <number?>, given: "hello"

All of this error message makes sense to me except the "symbol?" as the third parameter in make-myposn's contract.  One can't actually give a symbol as a third argument:
(make-myposn 3 4 'hi)
complains that it was given the wrong number of arguments, as one would expect.

Stephen Bloch
sbloch at adelphi.edu

Posted on the users mailing list.