Created
June 18, 2014 19:10
-
-
Save andybrackley/9f9d3b5de363a1d20639 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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