Created
July 17, 2015 11:33
-
-
Save dsyme/f07a195a5f0f412b34ec to your computer and use it in GitHub Desktop.
usig struct constructors
This file contains hidden or 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
[<Struct>] | |
type S(x:int) = | |
member a.X = x | |
// Using the explicit struct constructor | |
let v1 = [ 1..3 ] |> List.map S |> List.map (fun x -> x.X) | |
// Using the default struct constructor | |
let v2 = [ (); (); () ] |> List.map S |> List.map (fun x -> x.X) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment