Skip to content

Instantly share code, notes, and snippets.

@0x53A
Created January 12, 2018 17:20
Show Gist options
  • Save 0x53A/61b10a21c2524580999ccce9cec52c2b to your computer and use it in GitHub Desktop.
Save 0x53A/61b10a21c2524580999ccce9cec52c2b to your computer and use it in GitHub Desktop.
#r "System.ValueTuple.dll";;
type fstsnd = class
static member Fst ((x, _)) = x
static member Fst ((x, _, _)) = x
static member Fst ((x, _, _, _)) = x
static member Fst ((x, _, _, _, _)) = x
static member Fst ((x, _, _, _, _, _)) = x
static member Fst ((x, _, _, _, _, _, _)) = x
static member Fst ((x, _, _, _, _, _, _, _)) = x
static member Fst ((x, _, _, _, _, _, _, _, _)) = x
static member Snd ((_, x)) = x
static member Snd ((_, x, _)) = x
static member Snd ((_, x, _, _)) = x
static member Snd ((_, x, _, _, _)) = x
static member Snd ((_, x, _, _, _, _)) = x
static member Snd ((_, x, _, _, _, _, _)) = x
static member Snd ((_, x, _, _, _, _, _, _)) = x
static member Snd ((_, x, _, _, _, _, _, _, _)) = x
static member Item3 ((_, _, x)) = x
static member Item3 ((_, _, x, _)) = x
static member Item3 ((_, _, x, _, _)) = x
static member Item3 ((_, _, x, _, _, _)) = x
static member Item3 ((_, _, x, _, _, _, _)) = x
static member Item3 ((_, _, x, _, _, _, _, _)) = x
static member Item3 ((_, _, x, _, _, _, _, _, _)) = x
static member Item4 ((_, _, _, x)) = x
static member Item4 ((_, _, _, x, _)) = x
static member Item4 ((_, _, _, x, _, _)) = x
static member Item4 ((_, _, _, x, _, _, _)) = x
static member Item4 ((_, _, _, x, _, _, _, _)) = x
static member Item4 ((_, _, _, x, _, _, _, _, _)) = x
static member Item5 ((_, _, _, _, x)) = x
static member Item5 ((_, _, _, _, x, _)) = x
static member Item5 ((_, _, _, _, x, _, _)) = x
static member Item5 ((_, _, _, _, x, _, _, _)) = x
static member Item5 ((_, _, _, _, x, _, _, _, _)) = x
static member Item6 ((_, _, _, _, _, x)) = x
static member Item6 ((_, _, _, _, _, x, _)) = x
static member Item6 ((_, _, _, _, _, x, _, _)) = x
static member Item6 ((_, _, _, _, _, x, _, _, _)) = x
static member Item7 ((_, _, _, _, _, _, x)) = x
static member Item7 ((_, _, _, _, _, _, x, _)) = x
static member Item7 ((_, _, _, _, _, _, x, _, _)) = x
static member Item8 ((_, _, _, _, _, _, _, x)) = x
static member Item8 ((_, _, _, _, _, _, _, x, _)) = x
static member Item9 ((_, _, _, _, _, _, _, _, x)) = x
static member Fst (struct (x, _)) = x
static member Fst (struct (x, _, _)) = x
static member Fst (struct (x, _, _, _)) = x
static member Fst (struct (x, _, _, _, _)) = x
static member Fst (struct (x, _, _, _, _, _)) = x
static member Fst (struct (x, _, _, _, _, _, _)) = x
static member Fst (struct (x, _, _, _, _, _, _, _)) = x
static member Fst (struct (x, _, _, _, _, _, _, _, _)) = x
static member Snd (struct (_, x)) = x
static member Snd (struct (_, x, _)) = x
static member Snd (struct (_, x, _, _)) = x
static member Snd (struct (_, x, _, _, _)) = x
static member Snd (struct (_, x, _, _, _, _)) = x
static member Snd (struct (_, x, _, _, _, _, _)) = x
static member Snd (struct (_, x, _, _, _, _, _, _)) = x
static member Snd (struct (_, x, _, _, _, _, _, _, _)) = x
static member Item3 (struct (_, _, x)) = x
static member Item3 (struct (_, _, x, _)) = x
static member Item3 (struct (_, _, x, _, _)) = x
static member Item3 (struct (_, _, x, _, _, _)) = x
static member Item3 (struct (_, _, x, _, _, _, _)) = x
static member Item3 (struct (_, _, x, _, _, _, _, _)) = x
static member Item3 (struct (_, _, x, _, _, _, _, _, _)) = x
static member Item4 (struct (_, _, _, x)) = x
static member Item4 (struct (_, _, _, x, _)) = x
static member Item4 (struct (_, _, _, x, _, _)) = x
static member Item4 (struct (_, _, _, x, _, _, _)) = x
static member Item4 (struct (_, _, _, x, _, _, _, _)) = x
static member Item4 (struct (_, _, _, x, _, _, _, _, _)) = x
static member Item5 (struct (_, _, _, _, x)) = x
static member Item5 (struct (_, _, _, _, x, _)) = x
static member Item5 (struct (_, _, _, _, x, _, _)) = x
static member Item5 (struct (_, _, _, _, x, _, _, _)) = x
static member Item5 (struct (_, _, _, _, x, _, _, _, _)) = x
static member Item6 (struct (_, _, _, _, _, x)) = x
static member Item6 (struct (_, _, _, _, _, x, _)) = x
static member Item6 (struct (_, _, _, _, _, x, _, _)) = x
static member Item6 (struct (_, _, _, _, _, x, _, _, _)) = x
static member Item7 (struct (_, _, _, _, _, _, x)) = x
static member Item7 (struct (_, _, _, _, _, _, x, _)) = x
static member Item7 (struct (_, _, _, _, _, _, x, _, _)) = x
static member Item8 (struct (_, _, _, _, _, _, _, x)) = x
static member Item8 (struct (_, _, _, _, _, _, _, x, _)) = x
static member Item9 (struct (_, _, _, _, _, _, _, _, x)) = x
static member inline _invoke_fst (x : ^a) =
let inline call (arg, _ : ^b) =
((^a or ^b) : (static member Fst : _ -> _) arg) in
call (x, Unchecked.defaultof<fstsnd>)
static member inline _invoke_snd (x : ^a) =
let inline call (arg, _ : ^b) =
((^a or ^b) : (static member Snd : _ -> _) arg) in
call (x, Unchecked.defaultof<fstsnd>)
static member inline _invoke_item3 (x : ^a) =
let inline call (arg, _ : ^b) =
((^a or ^b) : (static member Item3 : _ -> _) arg) in
call (x, Unchecked.defaultof<fstsnd>)
static member inline _invoke_item4 (x : ^a) =
let inline call (arg, _ : ^b) =
((^a or ^b) : (static member Item4 : _ -> _) arg) in
call (x, Unchecked.defaultof<fstsnd>)
static member inline _invoke_item5 (x : ^a) =
let inline call (arg, _ : ^b) =
((^a or ^b) : (static member Item5 : _ -> _) arg) in
call (x, Unchecked.defaultof<fstsnd>)
static member inline _invoke_item6 (x : ^a) =
let inline call (arg, _ : ^b) =
((^a or ^b) : (static member Item6 : _ -> _) arg) in
call (x, Unchecked.defaultof<fstsnd>)
static member inline _invoke_item7 (x : ^a) =
let inline call (arg, _ : ^b) =
((^a or ^b) : (static member Item7 : _ -> _) arg) in
call (x, Unchecked.defaultof<fstsnd>)
static member inline _invoke_item8 (x : ^a) =
let inline call (arg, _ : ^b) =
((^a or ^b) : (static member Item8 : _ -> _) arg) in
call (x, Unchecked.defaultof<fstsnd>)
static member inline _invoke_item9 (x : ^a) =
let inline call (arg, _ : ^b) =
((^a or ^b) : (static member Item9 : _ -> _) arg) in
call (x, Unchecked.defaultof<fstsnd>)
end
let inline xfst x = fstsnd._invoke_fst x
let inline xsnd x = fstsnd._invoke_snd x
let inline xitem3 x = fstsnd._invoke_item3 x
let inline xitem4 x = fstsnd._invoke_item4 x
let inline xitem5 x = fstsnd._invoke_item5 x
let inline xitem6 x = fstsnd._invoke_item6 x
let inline xitem7 x = fstsnd._invoke_item7 x
let inline xitem8 x = fstsnd._invoke_item8 x
let inline xitem9 x = fstsnd._invoke_item9 x
let x = xfst (struct (1, 2))
let y = xfst (3, 4)
let y2 = xfst (3, 4, 5)
let xx = xsnd (struct (5, 6))
let yy = xsnd (7, 8)
let _ = xitem8 (1,2,3,4,5,6,7,8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment