ocaml
0
fork

Configure Feed

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

get rid of a few List.rev

+14 -11
+3 -3
lib/compiler/Eval.ml
··· 50 50 51 51 let coalesce_text = 52 52 let rec loop acc = function 53 - | [] -> Option.some @@ String.concat "" @@ List.rev acc 54 - | T.Text txt :: content -> loop (txt :: acc) content 53 + | [] -> Option.some @@ String.concat "" @@ Bwd.prepend acc [] 54 + | T.Text txt :: content -> loop (Bwd.snoc acc txt) content 55 55 | _ -> None 56 56 in 57 - loop [] 57 + loop Emp 58 58 59 59 let extract_text (node : located) = 60 60 let content = extract_content node in
+4 -4
lib/compiler/Parse.ml
··· 125 125 run [] Grammar.EOF checkpoint checkpoint supplier checkpoint 126 126 127 127 let maybe_with_errors (f : unit -> 'a) : ('a, 'a * 'b list) result = 128 - let errors = ref [] in 128 + let errors = ref Bwd.Emp in 129 129 let result = 130 130 let@ () = 131 131 Reporter.map_diagnostic @@ 132 132 fun d -> 133 - errors := d :: !errors; 133 + errors := Bwd.snoc !errors d; 134 134 d 135 135 in 136 136 f () 137 137 in 138 138 match !errors with 139 - | [] -> Result.ok result 140 - | errs -> Result.error (result, List.rev errs) 139 + | Emp -> Result.ok result 140 + | errs -> Result.error (result, Bwd.prepend errs []) 141 141 142 142 let parse_channel filename ch = 143 143 let@ () = Reporter.tracef "when parsing file `%s`" filename in
+1
lib/prelude/Forester_prelude.ml
··· 1 1 include Fun_util 2 + include Bwd 2 3 3 4 module String_util = String_util 4 5 module Option_util = Option_util
+5 -3
lib/prelude/List_util.ml
··· 1 + open Bwd 2 + 1 3 let nub xs = 2 4 let rec loop acc = function 3 - | [] -> List.rev acc 5 + | [] -> Bwd.prepend acc [] 4 6 | x :: xs -> 5 - let acc = if List.mem x acc then acc else x :: acc in 7 + let acc = if Bwd.mem x acc then acc else Bwd.snoc acc x in 6 8 loop acc xs 7 9 in 8 - loop [] xs 10 + loop Bwd.Emp xs
+1 -1
lib/prelude/dune
··· 1 1 (library 2 2 (name Forester_prelude) 3 - (libraries unix str ptime uucp bwd) 3 + (libraries unix ptime uucp bwd) 4 4 (preprocess 5 5 (pps ppx_repr)) 6 6 (public_name forester.prelude))