Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion examples/closure/dune
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

(executable
(name example)
(modules example)
Expand Down Expand Up @@ -57,3 +56,34 @@
(name examples)
(deps doc.svg)
)

(executable
(name partial)
(modules partial)
(libraries memgraph))

(rule
(target partial.gv)
(package memgraph)
(action
(with-outputs-to
%{target}
(with-accepted-exit-codes
0
(run ./partial.exe)))))

(rule
(target partial.svg)
(deps partial.gv)
(package memgraph)
(mode promote)
(action
(with-outputs-to
%{target}
(with-accepted-exit-codes
0
(run dot -Tsvg -o %{target} %{deps})))))

(alias
(name examples)
(deps partial.svg))
21 changes: 21 additions & 0 deletions examples/closure/partial.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

let test () =
let f x y z = x + y + z in
f

let test2 () =
let f x y z = x + y + z in
let g = f 11 in
f, g

let () =
let _f1 = test () in
let f2, _g2 = test2 () in
Memgraph.Repr.(context (fun ctx ->
Memgraph.Dot.print_list Format.std_formatter [
(* "f1", ctx.mk f1; *)
(* "f1 18", ctx.mk (f1 18); *)
"f2", ctx.mk f2;
(* "g2", ctx.mk g2; *)
"f2 18", ctx.mk (f2 18);
]))
122 changes: 122 additions & 0 deletions examples/closure/partial.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.