Let's say I have a struct like this:
(struct house (bedrooms bathrooms address price))
How can I create a sub-struct for, say, houses with 3 bedrooms and 2 bathrooms?
(struct 3-2-house house
; ???
; somehow fill in bedrooms=3 and bathrooms=2
; ???
)
(define house-on-apple-street (3-2-house "123 apple street" 100000))
It seems something like #:auto
is called for here but it's not clear how to apply #:auto
to fields inherited from parent struct ...
Thanks!
When you define a struct you can create struct by make-structname. After define struct you can use selector.
You can make struct in struct (family tree)