package exenum
Build efficient enumerations for datatypes. Inspired by Feat for Haskell.
Install
Dune Dependency
Authors
Maintainers
Sources
v0.82.0.tar.gz
sha256=ab25cd106937fefef265abc6e7157a1d48c5ea6663fab7d782914d9659ff4aee
md5=5367c3fe8d5a3b645c719b48889a6fce
doc/src/exenum.internals/tester.ml.html
Source file tester.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
open Exen open Convenience (* Generic version that can be instantiated to a Lwt version and a non-lwt version. *) let gen_tester print ?tos bind unit exen ?(from=bigzero) ?upto ?(verbose_period=10000) ~len f = assert (len > 0) ; assert (verbose_period > 0) ; let bigverbose_period = boi verbose_period in let test_current count index = let verbose = verbose_period > 0 && Big_int.eq_big_int bigzero (bigmod count bigverbose_period) in let test_value = get exen index in bind (if verbose then print (Printf.sprintf "Test number %s, index #%s ... %s" (sob count) (sob index) (match tos with None -> "" | Some tos -> "with " ^ tos test_value ^ " ... ")) else unit) (fun () -> bind (f test_value) (fun () -> if verbose then print "done\n" else unit)) in (* for loop, in which we double the current index every len iterations. *) let rec iterate count current remaining = (* End of this part? If yes, current := current * 2. *) if remaining = 0 then iterate count (2 **. current) len else (* Have we reached the upper bound? *) let continue = match upto with | None -> true | Some upper_bound -> big_compare current upper_bound < 0 in if continue then begin bind (test_current count current) (fun () -> iterate (succ count) (succ current) (remaining - 1)) end else (* We're done. *) unit in iterate bigzero from len
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>