10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-23 12:56:14 +01:00
quantum_package/ocaml/MO_label.ml

33 lines
690 B
OCaml
Raw Normal View History

2014-10-29 16:56:16 +01:00
open Core.Std;;
type t =
| Guess
| Canonical
| Natural
| Localized
2014-11-03 15:37:02 +01:00
| Orthonormalized
2014-10-29 16:56:16 +01:00
| None
with sexp
;;
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
;;