Skip to content

Instantly share code, notes, and snippets.

@iitalics
Created October 30, 2024 19:16
Show Gist options
  • Save iitalics/2229336c53d7b88963f2e00503ecea93 to your computer and use it in GitHub Desktop.
Save iitalics/2229336c53d7b88963f2e00503ecea93 to your computer and use it in GitHub Desktop.
$ cat main.ml
let alt x y =
let rec seq1 () =
Seq.Cons (x, seq2)
and seq2 () =
Seq.Cons (y, seq1)
in seq1
$ ocamlopt -dclambda main.ml
clambda:
(seq
(let
(alt/269
(closure
(fun camlMain.alt_269 2 x/271 y/272
(let
(clos/404
(closure
(fun camlMain.seq1_273 1 param/397[int] env/402
(makeblock 0 (field_imm 5 env/402) (offset env/402 3)))
(fun camlMain.seq2_274 1 param/398[int] env/403
(makeblock 0 (field_imm 3 env/403) (offset env/403 -3)))
x/271 y/272))
(offset clos/404 0))) ))
(setfield_ptr(root-init) 0 (read_symbol camlMain) alt/269))
0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment