ocaml
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Equivalently simplify code around next_uri

+6 -16
+3 -9
lib/compiler/URI_util.ml
··· 29 29 let@ prefix', key = Option.bind @@ URI_scheme.split_addr uri in 30 30 if prefix = prefix' then Some key else None 31 31 in 32 - let last_sequential = 33 - List.fold_left 34 - (fun acc_i i -> 35 - if i > acc_i then i else acc_i 36 - ) 37 - 0 38 - keys 39 - in 40 32 let next = 41 33 match mode with 42 - | `Sequential -> last_sequential + 1 34 + | `Sequential -> 35 + let last_sequential = List.fold_left (fun acc_i i -> if i > acc_i then i else acc_i ) 0 keys in 36 + last_sequential + 1 43 37 | `Random -> random_not_in keys 44 38 in 45 39 (match prefix with (None | Some "") -> "" | Some prefix -> prefix ^ "-") ^ BaseN.Base36.string_of_int next
+3 -7
lib/core/URI_scheme.ml
··· 35 35 match String.rindex_opt name '-' with 36 36 | Some i -> 37 37 let prefix = String.sub name 0 i 38 - and suffix = String.sub name (i + 1) (String.length name - i - 1) 39 - in 40 - begin 41 - match BaseN.Base36.int_of_string suffix with 42 - | Some key -> Some (Some prefix, key) 43 - | None -> None 44 - end 38 + and suffix = String.sub name (i + 1) (String.length name - i - 1) in 39 + let@ key = Option.map @~ BaseN.Base36.int_of_string suffix in 40 + Some prefix, key 45 41 | _ -> 46 42 let@ key = Option.map @~ BaseN.Base36.int_of_string name in 47 43 None, key