, , , F #, , .
:
let interpreteSport (sport:string) (player:int) =
F # , #, , , , , .
, , :
:? Individual -> interpretSport(sport.Name)
, , .
! , , ?
, , , interpreteSport, , F #.
, , , " ", , .
, :
let parzFun = interpretSport sport.Name
, , :
let result = parzFun 1
, , 'int -> unit': F # :
a -> b -> c -> d -> retval, a, b, c, d .. , retVal - .
interpreteSport : string -> int -> unit, unit - , " ", # void, , - , , void - , void #.
, , , (), , , int -> unit, , .
, , , 2 int -> unit, , .
- , , , , :
:? Team as teamSport -> interpretSport(teamSport.Name,teamSport.numberOfPlayers)
, , : 2 , , , , . , , : - , : ('a *' b) - , F # : , 'a (generic, case) ' b (generic, integer).
, :
:? Team as teamSport -> interpretSport teamSport.Name teamSport.numberOfPlayers
, , , , , int -> unit (, ), unit, , unit (interpreteSport printfn). , , , :
let matchSport (sport:Sport) =
match sport with
| :? Individual -> interpretSport sport.Name 1
| :? Team as teamSport -> interpretSport teamSport.Name teamSport.numberOfPlayers
| _ -> printfn "not a sport"