Setup Scala
This commit is contained in:
parent
8dec7591dd
commit
13a8e74189
37 changed files with 290 additions and 187 deletions
4
ocaml/lib/problems/generator/dune
Normal file
4
ocaml/lib/problems/generator/dune
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
(executable
|
||||
(name gen)
|
||||
(modules gen)
|
||||
(libraries fmt))
|
||||
21
ocaml/lib/problems/generator/gen.ml
Normal file
21
ocaml/lib/problems/generator/gen.ml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
let pp_module_name (f : Format.formatter) (module_name : string) : unit =
|
||||
Fmt.pf f "(module %s: Problem.T)" module_name
|
||||
|
||||
let pp_file (f : Format.formatter) (module_names : string list) : unit =
|
||||
Fmt.(
|
||||
pf f {ocaml|let all: (module Problem.T) list = [%a]|ocaml}
|
||||
(list ~sep:semi pp_module_name)
|
||||
module_names)
|
||||
|
||||
let () =
|
||||
let output_filename = Array.get Sys.argv 1 in
|
||||
let filenames =
|
||||
Sys.argv |> Array.to_list |> List.tl |> List.tl
|
||||
|> List.map
|
||||
(String.mapi (fun i c -> if i = 0 then Char.uppercase_ascii c else c))
|
||||
|> List.map (fun s -> String.sub s 0 (String.length s - 3))
|
||||
in
|
||||
let contents = Fmt.str "%a" pp_file filenames in
|
||||
let c = open_out output_filename in
|
||||
output_string c contents;
|
||||
close_out c
|
||||
Loading…
Add table
Add a link
Reference in a new issue