2016-06-30 6 views
2

私が定義型を参照するのに適した代数的データ型をコンパイルするために使用しようとしています:ラケット:定義型参照

Books:     Author. Title. Publisher, City Year 
Articles from Magazines: Author. Title. Name of Magazine, Year 
Conference Contributions: Author. Title. Name of Conference. Publisher, City Year 

は、残念ながら、私はこの問題にアプローチする方法は考えています。私はdefine-typeの特徴とその違いを定義するstructを知っていますが。

誰でも正しい方向に向けることができますか?大変感謝しています! define-typeを仮定

答えて

1

htdp2/abstractionからdefine-typeを指す:

(define-type reference 
    (book (author string?) (title string?) (publisher string?) (city string?) (year number?)) 
    (magazine-article (author string?) ...etc...) 
    (conference-contribution (author string?) ...etc...))