I'm trying to imitate recursive types in OCaml in untyped Racket, but I can't seem to find documentation on defining recursive structs. How would I go about mapping this:
type example =
| Red
| Blue of example
| Yellow of example * example;;
into something in Racket?
I've tried the following:
(struct Red ())
(struct Blue (e1))
(struct Yellow (e1 e2))
(struct example/c
(or/c (Red)
(Blue example/c)
(Yellow example/c example/c)))
However, it doesn't work as expected when I put example/c in a contract, because it claims it's a procedure. Any help?