Skip to content

Instantly share code, notes, and snippets.

@orient-man
Created October 11, 2017 08:59
Show Gist options
  • Save orient-man/baba3f65abedf7bc91a74076e86733f2 to your computer and use it in GitHub Desktop.
Save orient-man/baba3f65abedf7bc91a74076e86733f2 to your computer and use it in GitHub Desktop.
type Input = A of int | B of int | C of int
type Output = { A: int; B: int; C: int; Text: string }
seq {
yield (A 5, B 10), "text 1"
yield (B 5, C 10), "text 2"
yield (A 5, C 10), "text 3"
}
|> Seq.map (function
| (A a, B b), text -> { A = a; B = b; C = a * b; Text = text }
| (B b, C c), text -> { A = b * c; B = b; C = c; Text = text }
| (A a, C c), text -> { A = a; B = a * c; C = c; Text = text }
| _ -> failwith "invalid input")
|> List.ofSeq
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment