This is my code, which is just a try...
(define-struct cupboard (upperdrawer middledrawer lowerdrawer))
(define-struct room (name furniture))
(define myrooms
(list
(make-room "Kitchen"
(list
(make-cupboard "Salt" "Sugar" "Pepper")
(make-cupboard "Tofu" "Sausage" "Beef")))
(make-room "Bathroom"
(list
(make-cupboard "Toothbrush" "Soap" "Shampoo")))
(make-room "Sleeping room"
(list
(make-cupboard "Red Socks" "Blue Socks" "Yellow Socks")
(make-cupboard "Suits" "Dresses" "Shoes")))))
(define cupboardcontents
(lambda (myrooms)
(cond((room? (first myrooms))
(cupboard? (first myrooms))
(cupboardcontents (rest myrooms))
((cupboard?(first myrooms)) (list
(cupboard-upperdrawer myrooms)
(cupboard-middledrawer myrooms)
(cupboard-lowerdrawer myrooms)))
))))
(cupboardcontents myrooms)
Now the task is it to use recursion get a list as output which includes the cupboard contents. Can anybody help here?