機能を作ろうとしています
author-book
本を与えられて、本の著者を生み出します。これのために私が作成したデータはここにあります-
(define-struct audiobook ( title author length-in-minutes voice-person))
(define-struct ebook ( title author size-in-kolobytes symbol ))
(define-struct hardcover (title author number-of-pages genre ))
(define audiobook1 (make-audiobook "The Hunger Games" "Suzanne Collins" "50 minutes" "David Larrson"))
(define audiobook2 (make-audiobook "Catching Fire" "Suzanne Collins" "55 minutes" "David Larrson"))
(define audiobook3 (make-audiobook "Mockingjay" "Suzanne Collins" "40 minutes" "David Larrson"))
(define ebook1 (make-ebook "Divergent" "Veronica Roth" "100000kbs" 'Kindle))
(define ebook2 (make-ebook "Dracula" "Bram Stocker " "134000kbs" 'Ebook))
(define ebook3 (make-ebook "Jane Eyre" "Charlotte Brontë " "400000kbs" 'IPad))
(define hardcover1 (make-hardcover "Pursued" "Jud White" "100000kbs" "Crime"))
(define hardcover2 (make-hardcover "Private Berlin" "James Patterson" "100000kbs" "Suspense"))
(define hardcover3 (make-hardcover "Francona" "Terry Francona" "100000kbs" "Sports"))
私はもう試した
(define (author-of-book n)
(audiobook-author n))
これは私にオーディオブックだけの作者を与えます。3つの別々の関数を書かなくても、残りの作者を取得する方法はありますか?(ebook-authorのように...)