说我有一个空集。我想在该集合中创建多组字符串。我该怎么做呢?
例如,我正在尝试编写一个以Set<String*String>
,Set<String>
和Set<String>
为参数的函数,并返回Set<Set<String>>
。< / p>
type Country = string;;
type Chart = Set<Country*Country>;;
type Colour = Set<Country>;;
type Colouring = Set<Colour>;;
功能是:
let rec extColouring (chart: Chart) (colours : Colouring) (country : Country) =
该函数的值应为:
(*
val extColouring :
chart:Chart -> colours:Colouring -> country:Country -> Set<Set<Country>>
*)
例如,图表就像
val myWorld : Chart =
set
[("Andorra", "Benin"); ("Andorra", "Canada"); ("Andorra", "Denmark");
("Benin", "Canada"); ("Benin", "Denmark"); ("Canada", "Denmark");
("Estonia", "Canada"); ("Estonia", "Denmark"); ("Estonia", "Finland");
...]