Skip to content

Instantly share code, notes, and snippets.

@dsyme
Created July 17, 2015 11:33
Show Gist options
  • Save dsyme/f07a195a5f0f412b34ec to your computer and use it in GitHub Desktop.
Save dsyme/f07a195a5f0f412b34ec to your computer and use it in GitHub Desktop.
usig struct constructors
[<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