package devkit
Development kit - general purpose library
Install
Dune Dependency
Authors
Maintainers
Sources
devkit-1.3.tbz
sha256=dae965685dceed47ad8e9844f12fe707dafdf2c3bdd46d0431d5b4d1e7754b23
sha512=b94ade804d751db87434042bbaa821fa8e82e233820a76806f910e2da040094b137e88a3579911a1626930912622b064c776ddbcb6991fb7111021ebf6553fdc
doc/src/devkit.core/prelude.ml.html
Source file prelude.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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
(** Useful shortcuts *) module U = ExtUnix.Specific module Enum = ExtEnum module Int = Factor.Int module Float = Factor.Float let ($) f g = fun x -> f (g x) let ($$) f g = fun x y -> f (g x) (g y) let (!!) = Lazy.force external id : 'a -> 'a = "%identity" external identity : 'a -> 'a = "%identity" let flip f x y = f y x let some x = Some x let const x = fun () -> x let apply2 f = fun (x,y) -> f x, f y let printfn fmt = Printf.ksprintf print_endline fmt let eprintfn fmt = Printf.ksprintf prerr_endline fmt let curry f a b = f (a, b) let uncurry f (a,b) = f a b module New(T : sig type t end)() = struct type t = T.t let inj = id let proj = id let inj_list = id let proj_list = id let inject = id let project = id let inject_list = id let project_list = id end module Fresh(T : sig type t val compare : t -> t -> int end)() = struct type t = T.t let inject = id let project = id let inject_list = id let project_list = id let compare = T.compare let equal a b = T.compare a b = 0 end let (+=) a b = a := !a + b let (-=) a b = a := !a - b let tuck l x = l := x :: !l let cons l x = x :: l let round f = let bot = floor f in if f -. bot < 0.5 then bot else bot +. 1. let atoi name v = try int_of_string v with _ -> Exn.fail "%s %S not integer" name v let call_me_maybe f x = match f with | None -> () | Some f -> f x let unsigned_mod x y = match x mod y with z when z >= 0 -> z | z -> y + z let unsigned_mod32 x y = match Int32.rem x y with z when z >= 0l -> z | z -> Int32.add y z let unsigned_mod64 x y = match Int64.rem x y with z when z >= 0L -> z | z -> Int64.add y z let () = Lwt_engine.set @@ new Lwt_engines.poll
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>