私は今日 F# の勉強を始めたばかりで、 http: //www.tryfsharp.org/Learn/getting-started#data-structures にある F# チュートリアルに取り組み始めました。
上記のセクションでは、レコードとオプションの種類を説明するために、コードの 3 つのスニペットが提供されています。
type Book =
{ Name: string;
AuthorName: string;
Rating: int option;
ISBN: string }
let unratedEdition =
{ Name = "Expert F#";
AuthorName = "Don Syme, Adam Granicz, Antonio Cisternino";
Rating = None;
ISBN = "1590598504" }
let printRating book =
match book.Rating with
| Some rating ->
printfn "I give this book %d star(s) out of 5!" rating
| None -> printfn "I didn't review this book"
私はそのようにprintRatingを適用できると思った
printRating unratedEdition
しかし、次のエラーが表示されます
stdin(63,13): error FS0001: This expression was expected to have type
FSI_0005.Book
but here has type
FSI_0009.Book
私はここで何が間違っているのかについてちょっと立ち往生しています。私が完全に行方不明になっている明らかな理由はありますか?