package acgtk
Abstract Categorial Grammar development toolkit
Install
Dune Dependency
Authors
Maintainers
Sources
acg-2.1.0-20240219.tar.gz
sha512=5d380a947658fb1201895cb4cb449b1f60f54914c563e85181d628a89f045c1dd7b5b2226bb7865dd090f87caa9187e0ea6c7a4ee3dc3dda340d404c4e76c7c2
doc/src/acgtk.utilsLib/product.ml.html
Source file product.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
module type Elt = sig type t val to_string : t -> string end module Make (E : Elt) = struct type tuple = E.t list type t = tuple list let list_to_tuple t = t let tuple_to_list t = t let tuple_to_string t = Printf.sprintf "(%s)" (Utils.string_of_list ", " E.to_string t) let to_list p = p let to_string p = Utils.string_of_list "\n" tuple_to_string p let extend_relation value tuples acc = List.fold_left (fun new_tuples tuple -> (value :: tuple) :: new_tuples) acc tuples let cartesian_product values tuples = List.fold_left (fun new_tuples value -> extend_relation value tuples new_tuples) [] values let rec product_aux arity values tuples = if arity = 0 then tuples else let new_tuples = cartesian_product values tuples in product_aux (arity - 1) values new_tuples let product arity values = let one_ary_tuples = List.map (fun elt -> [ elt ]) values in product_aux (arity - 1) values one_ary_tuples let fold f start product = List.fold_left f start product end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>