Skip to content

Instantly share code, notes, and snippets.

@Octachron
Created July 10, 2021 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Octachron/28691ede67b84a8d70341763fc1d6c62 to your computer and use it in GitHub Desktop.
Save Octachron/28691ede67b84a8d70341763fc1d6c62 to your computer and use it in GitHub Desktop.
type e = ..
type e += A | B | C | D | E | F
let f = function
| A -> 1
| B -> 2
| C -> 3
| D -> 4
| E -> 5
| F -> 6
| _ -> 7
(* -dlambda output:
f/88 =
(function param/90 : int
(if (== param/90 A/82) 1
(if (== param/90 B/83) 2
(if (== param/90 C/84) 3
(if (== param/90 D/85) 4
(if (== param/90 E/86) 5 (if (== param/90 F/87) 6 7)))))))
*)
type t = A | B | C | D | E | F
let g = function
| A -> 1
| B -> 2
| C -> 3
| D -> 4
| E -> 5
| F -> 6
(* dlambda output:
g/98 =
(function param/100 : int
(switch* param/100
case int 0: 1
case int 1: 2
case int 2: 3
case int 3: 4
case int 4: 5
case int 5: 6)))
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment