(********************************************************************)
(*  OCaml code from the book ``Learn Programming with OCaml''       *)
(*  See https://usr.lmf.cnrs.fr/lpo/                                *)
(*                                                                  *)
(*  Sylvain Conchon and Jean-Christophe Filliâtre                   *)
(*  Copyright 2025 Université Paris-Saclay and CNRS                 *)
(*                                                                  *)
(*  Openly licensed via CC BY SA 4.0                                *)
(*  See https://creativecommons.org/licenses/by-sa/4.0/deed.en      *)
(********************************************************************)

(* Program 42 on page 232
   Searching in a Hash Table *)

  let bucket_of x h =
    (X.hash x land max_int) mod (Array.length h.buckets)

  let mem_bucket x b =
    List.exists (X.equal x) b

  let mem x h =
    let i = bucket_of x h in
    mem_bucket x h.buckets.(i)

This document was generated using caml2html