package hack_parallel
Parallel and shared memory library
Install
Dune Dependency
Authors
Maintainers
Sources
1.0.1.tar.gz
md5=ba7c72bc207e326b72e294fc76f6ad2c
sha512=5020d47f97bea2f88e2a40411894d03232a7f2282606926c93c7d4c96d72e94a966be852897a9b16f7e0893ba376512045abb9d93020a7c03c3def4f3d918f8e
doc/src/hack_parallel.collections/myMap.ml.html
Source file myMap.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 56
(** * Copyright (c) 2015, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * *) module type S = MyMap_sig.S module Make(Ord: Map.OrderedType) : S with type key = Ord.t = struct include Map.Make(Ord) let get x t = try Some (find x t) with Not_found -> None let find_unsafe = find let union ?combine x y = let combine = match combine with | None -> (fun _ fst _ -> Some fst) | Some f -> f in union combine x y let compare x y = compare Pervasives.compare x y let equal x y = compare x y = 0 let keys m = fold (fun k _ acc -> k :: acc) m [] let values m = fold (fun _ v acc -> v :: acc) m [] let elements m = fold (fun k v acc -> (k,v)::acc) m [] let map_env f env m = fold ( fun x y (env, acc) -> let env, y = f env y in env, add x y acc ) m (env, empty) let choose x = try Some (choose x) with Not_found -> None let from_keys keys f = List.fold_left begin fun acc key -> add key (f key) acc end empty keys let add ?combine key new_value map = match combine with | None -> add key new_value map | Some combine -> begin match get key map with | None -> add key new_value map | Some old_value -> add key (combine old_value new_value) map end end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>