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