Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andybrackley/9f9d3b5de363a1d20639 to your computer and use it in GitHub Desktop.
Save andybrackley/9f9d3b5de363a1d20639 to your computer and use it in GitHub Desktop.
module ComplexTypes =
let backgroundTypes =
dict [ ("Buy", "Blue")
("Sell", "Red")
("My", "Green")
("Their", "Yellow") ]
let stringFormatTypes =
dict [ ("Price", "#.##")
("Qty", "#.0") ]
let byteFormatTypes =
dict [ ("Char", "ByteConverter")
("Side", "SideConverter") ]
type FrameworkElement = { Format : string; ValueConverter : string ; Colour : string }
let stringTypes =
backgroundTypes
|> Seq.collect (fun x ->
stringFormatTypes
|> Seq.map (fun y -> x.Key + "_" + y.Key,
{ Format = y.Value; Colour = x.Value; ValueConverter = "" } ))
stringTypes |> Seq.iter( fun (x, y) -> printfn "%s_%A" x y)
let byteTypes =
backgroundTypes
|> Seq.collect (fun x ->
byteFormatTypes
|> Seq.map (fun y -> x.Key + "_" + y.Key,
{ Format = ""; Colour = x.Value; ValueConverter = y.Value } ))
byteTypes |> Seq.iter( fun (x, y) -> printfn "%s_%A" x y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment