10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-05 13:43:57 +01:00
quantum_package/ocaml/MO_label.ml

33 lines
694 B
OCaml
Raw Normal View History

2017-08-18 18:28:33 +02:00
open Core;;
2014-10-29 16:56:16 +01:00
type t =
| Guess
| Canonical
| Natural
| Localized
2014-11-03 15:37:02 +01:00
| Orthonormalized
2014-10-29 16:56:16 +01:00
| None
2017-08-18 18:28:33 +02:00
[@@deriving sexp]
2014-10-29 16:56:16 +01:00
;;
let to_string = function
| Guess -> "Guess"
| Canonical -> "Canonical"
2014-11-03 15:37:02 +01:00
| Orthonormalized -> "Orthonormalized"
2014-10-29 16:56:16 +01:00
| Natural -> "Natural"
| Localized -> "Localized"
| None -> "None"
;;
let of_string s =
2014-12-25 23:53:29 +01:00
match String.lowercase (String.strip s) with
2014-10-29 16:56:16 +01:00
| "guess" -> Guess
| "canonical" -> Canonical
| "natural" -> Natural
| "localized" -> Localized
2014-11-03 15:37:02 +01:00
| "orthonormalized" -> Orthonormalized
2014-10-29 16:56:16 +01:00
| "none" -> None
2014-12-25 23:53:29 +01:00
| _ -> (print_endline s ; failwith "MO_label should be one of:
Guess | Orthonormalized | Canonical | Natural | Localized | None.")
2014-10-29 16:56:16 +01:00
;;