Skip to content

Instantly share code, notes, and snippets.

@stedolan
Created April 19, 2022 08:55
Show Gist options
  • Save stedolan/64a08ec762bf74ff650e5b48ed92166f to your computer and use it in GitHub Desktop.
Save stedolan/64a08ec762bf74ff650e5b48ed92166f to your computer and use it in GitHub Desktop.
type n = Z | S of n
let rec gen_locals (local_ n) depth _ = local_
if depth = 0
then
S n
else
let s = S n in
let m = gen_locals s (depth - 1) (ref 42) in
let _ = gen_locals m (depth - 1) (ref 42) in
S n
let () =
match gen_locals Z 20 (ref 42) with
| S Z -> print_endline "ok\n"
| _ -> assert false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment