10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-12 08:15:27 +02:00
quantum_package/ocaml/Qputils.ml

30 lines
584 B
OCaml

open Core.Std;;
(*
let rec transpose = function
| [] -> []
| []::tail -> transpose tail
| (x::t1)::t2 ->
let new_head = (x::(List.map List.hd t2))
and new_tail = (transpose (t1 :: (List.map List.tl t2) ))
in
new_head @ new_tail
;;
*)
let input_to_sexp s =
let result =
String.split_lines s
|> List.filter ~f:(fun x->
(String.strip x) <> "")
|> List.map ~f:(fun x->
"("^(String.tr '=' ' ' x)^")")
|> String.concat
in
print_endline ("("^result^")");
"("^result^")"
|> Sexp.of_string
;;