package comby
A tool for structural code search and replace that supports ~every language
Install
Dune Dependency
Authors
Maintainers
Sources
comby-kernel.1.7.0.tar.gz
md5=ee6556d8bd9b25ed0445ebe23862e48a
sha512=e6386c8ce5ef14bbcab2b0ead5b1edc39375438f56330d5f02e81e467afe6623a7e299f97f26008d77bbc62850c6dc63a7cbe5b81671b5183ff3adeee5946bb3
doc/src/comby.pipeline/fold.ml.html
Source file fold.ml
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 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
open Core open Camlzip open Configuration open Command_input let paths ~init ~f bound_count paths = match bound_count with | None -> List.fold paths ~init ~f:(fun count path -> count + f ~input:(Path path) ~output_path:(Some path)) | Some bound_count -> List.fold_until paths ~init ~finish:(fun x -> x) ~f:(fun acc path -> if acc > bound_count then Stop acc else Continue (acc + f ~input:(Path path) ~output_path:(Some path))) let loc_paths paths = List.fold paths ~init:0 ~f:(fun acc paths -> In_channel.read_lines paths |> List.length |> (+) acc) let with_zip zip_file ~f = let zip_in = Zip.open_in zip_file in let result = f zip_in in Zip.close_in zip_in; result let zip_paths ~init ~f zip paths bound_count = match bound_count with | None -> List.fold paths ~init ~f:(fun count ({ Zip.filename; _ } as entry) -> let source = Zip.read_entry zip entry in count + f ~input:(String source) ~output_path:(Some filename)) | Some max_count -> List.fold_until paths ~init ~finish:(fun x -> x) ~f:(fun count ({ Zip.filename; _ } as entry) -> if count > max_count then Stop count else let source = Zip.read_entry zip entry in Continue (count + f ~input:(String source) ~output_path:(Some filename))) let loc_zip zip_file paths = with_zip zip_file ~f:(fun zip -> List.fold paths ~init:0 ~f:(fun acc entry -> let source = Zip.read_entry zip entry in acc + (List.length (String.split_lines source)))) let interactive ~init ~f paths = List.fold ~init paths ~f:(fun (acc, c) path -> match f ~input:(Path path) ~path:(Some path) with | Some rewritten_source, c' -> Interactive.{ path; rewritten_source }::acc, c+c' | None, c' -> acc, c+c')
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>