On Mon, Aug 2, 2010 at 9:37 AM, Shriram Krishnamurthi <s...@cs.brown.edu> wrote:
> Here is a sequence of steps to do something that seems extremely
> simple.  I want to create a binary tree of T.
>
> First, I have no idea what this documentation means:
>
> (struct:n (t ...))
> is the type of structures named n with field types t.
>
> All of "struct", "n" and "t" are italicized, suggesting they're all
> meta-variables.  But only "n" and "t" are explained in the document.
> Perhaps "struct:" is meant literally?

This documentation is written confusingly, I'll fix that.

> The next few things I do fail miserably, until I get this far:
>
> (define-struct: (T) Node ([v : T] [l : (BinTreeof t)] [r : (BinTreeof t)]))
> (define-type (BinTreeof t)
>  (U 'empty
>     [Node t]))
>
> Now we get a classic impenetrable error message:
>
>  Type Checker: Structure type constructor Node applied to non-regular
>  arguments (Error) in: (Node t)
>
> Whatever that means.  I rename the two "t"'s in Node to "T"'s:
>
> (define-struct: (T) Node ([v : T] [l : (BinTreeof t)] [r : (BinTreeof t)]))
> (define-type (BinTreeof t)
>  (U 'empty
>     [Node t]))

This is the same code as above.  Did you mean something different?
-- 
sam th
sa...@ccs.neu.edu
_________________________________________________
  For list-related administrative tasks:
  http://lists.racket-lang.org/listinfo/dev

Reply via email to