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
2 changes: 2 additions & 0 deletions tests/list/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/list_test.ml
/list_test_unnesting.ml
32 changes: 31 additions & 1 deletion tests/list/dune
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,29 @@
(:peano %{project_root}/std/.Peano.objs/byte/peano.cmi)
(:exec %{project_root}/src/noCanren.exe)
(:input list_test.ml2mk.ml))
(mode
(promote (until-clean)))
(action
(run
sh
-c
"%{exec} -w -8 %{input} -rectypes -o %{targets} | ocamlformat --enable-outside-detected-project --impl -")))

(rule
(targets list_test_unnesting.ml)
(deps
(:list %{project_root}/std/.List.objs/byte/list.cmi)
(:peano %{project_root}/std/.Peano.objs/byte/peano.cmi)
(:exec %{project_root}/src/noCanren.exe)
(:input unnesting.ml2mk.ml))
(mode
(promote (until-clean)))
(action
(run
sh
-c
"%{exec} -unnesting-mode -without-activate-tactics -w -8 %{input} -rectypes -o %{targets} ")))

(executable
(name list_test_run)
(libraries GT OCanren OCanren.tester Peano List)
Expand All @@ -27,5 +44,18 @@
OCanren-ppx.ppx_distrib
GT.ppx_all)))

(executable
(name list_test_run2)
(libraries GT OCanren OCanren.tester Peano List)
(modules list_test_run2 list_test_unnesting)
(flags
(:standard -open OCanren.Std))
(preprocess
(pps
OCanren-ppx.ppx_repr
OCanren-ppx.ppx_fresh
OCanren-ppx.ppx_distrib
GT.ppx_all)))

(cram
(deps ./list_test_run.exe))
(deps ./list_test_run.exe ./list_test_run2.exe))
1 change: 1 addition & 0 deletions tests/list/list_test.t
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
$ ./list_test_run2.exe
$ ./list_test_run.exe
lenght, all answers {
q=5;
Expand Down
15 changes: 15 additions & 0 deletions tests/list/list_test_run2.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
open OCanren
open OCanren.Std
open Tester
open List_test_unnesting

let () =
let injected : int ilogic Std.List.injected = OCanren.Std.list ( !! ) [ 1 ] in
let _ =
OCanren.(run q)
(list_map (fun x q17 -> x === q17) injected)
(fun rr -> rr#reify (Std.List.reify OCanren.reify))
|> OCanren.Stream.hd
in
()
;;
11 changes: 11 additions & 0 deletions tests/list/unnesting.ml2mk.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
open List
open Peano

let list_map f xs =
let rec helper xs =
match xs with
| [] -> []
| x :: xs -> f x :: helper xs
in
helper xs
;;