4
我想使用F#記錄,記錄Race和Runner,其中Race引用Runner和Runner引用Race。對於常規課程,這是否可以與記錄結合使用?F#記錄是否支持循環參考A - > B - > A?
type Race = {
raceIdentifier : int
carriedWeightMean : decimal
prizeMoneyPercentileCountry : int64
noOfHorses : int
runners : Runner list
}
type Runner = {
horseId : int
finishPositionSequence : int64
lbw : decimal
horseNumberOfRaces : int
mutable race : Race
}
我使用「與」關鍵字,但是這似乎並不奏效嘗試:
type Race = {
raceIdentifier : int
carriedWeightMean : decimal
prizeMoneyPercentileCountry : int64
noOfHorses : int
race : Race
} with Runner = {
horseId : int
finishPositionSequence : int64
lbw : decimal
horseNumberOfRaces : int
race : Race
}
一步遠離電腦... – gradbot 2011-01-07 05:15:36