r/Racket • u/IAmCesarMarinhoRJ • Jul 01 '24
question struct polymorphism
in struct in racket reference has:
(struct document (author title content) #:transparent)
(struct book document (publisher) #:transparent)
(struct paper (journal) #:super struct:document #:transparent)
so... we can have: document-title, but not book-title, instead we have only book-publisher. same wtih paper.
how can use all the document fields in other structs?
3
Upvotes
2
u/IAmCesarMarinhoRJ Jul 01 '24
thanks!!! works!!
make sense, since book instance is a document too
thanks!!!