1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
(** Mishmosh of internal helper functions *)
open! Base
let try0 f =
match f () with
| exception exn ->
Or_error.error "Caught exception" exn Exn.sexp_of_t
| result ->
Or_error.return result
let try1 f a =
match f a with
| exception exn ->
Or_error.error "Caught exception" exn Exn.sexp_of_t
| result ->
Or_error.return result
let try1' ~msg f a =
match f a with
| exception exn ->
Or_error.error msg exn Exn.sexp_of_t
| result ->
Or_error.return result
let complement' =
String.tr_multi ~target:"AaTtUuGgCcYyRrSsWwKkMmBbDdHhVvNn"
~replacement:"TtAaAaCcGgRrYySsWwMmKkVvHhDdBbNn"
let complement s =
let tr = Staged.unstage complement' in
tr s
let rev_complement s = String.rev @@ complement s