Ephemeron.Kn.MakeSeeded(3)

πŸ’… Ephemeron.Kn.MakeSeeded β€” bestie edition ✨

okay so real talk: this is a page straight out of the OCaml library manual, and it's about building a weak hash table β€” like a hash table but the entries can just… ghost you when nobody's looking πŸ‘». Sit down, grab a strawberry πŸ“, we're doing this.


🌸 NAME 🌸

Ephemeron.Kn.MakeSeeded β€” the functor that builds you an implementation of a weak hash table. that's it, that's the vibe 🫢


πŸ¦‹ Module πŸ¦‹

Module Ephemeron.Kn.MakeSeeded

like, that's the whole module path. iconic, no notes.


✨ Documentation ✨

πŸŽ€ the module itself

Module MakeSeeded
 : (H : Hashtbl.SeededHashedType) -> sig end

So the way this works: MakeSeeded is a functor that builds you an implementation of a weak hash table πŸ’–. And the seed situation? It's basically the same energy as the seed in Hashtbl.MakeSeeded β€” same idea, same family, iykyk.

Parameters (the one thing you gotta hand it):

  • "H" β€” of type Stdlib.Hashtbl.SeededHashedType. that's your hashing bestie, you supply it, the functor does the rest πŸ”₯

πŸ‘‘ the types it makes

  • type key β€” your key type, slaying as always
  • type !'a t β€” the actual table type, parameterized by 'a. note the ! β€” that's the variance marker doing main character energy ✨

πŸ’… the functions bestie, all of them

  • val create : ?random:bool -> int -> 'a t β€” makes you a fresh new table, optionally with the ?random flag, sized by that int 🌈
  • val clear : 'a t -> unit β€” wipes it. gone. empty. no cap.
  • val reset : 'a t -> unit β€” the other reset-flavored one, lowkey different from clear, both unit-returning 🧚
  • val copy : 'a t -> 'a t β€” dupe it, twin it, give you a whole new table πŸ’–
  • val add : 'a t -> key -> 'a -> unit β€” put a binding in. key in, value in, done πŸŽ€
  • val remove : 'a t -> key -> unit β€” yeet that binding out by its key
  • val find : 'a t -> key -> 'a β€” get the value for a key. note: returns 'a, not an option, so like… be normal about it πŸ™ˆ
  • val find_opt : 'a t -> key -> 'a option β€” the polite version, hands you 'a option so you can handle the nothingness gracefully πŸ¦‹
  • val find_all : 'a t -> key -> 'a list β€” all the values for that key, in a 'a list. yes queen, plural 🌸
  • val replace : 'a t -> key -> 'a -> unit β€” swap that binding out for a new value, clean and simple
  • val mem : 'a t -> key -> bool β€” is this key in here or not, bool, that's the whole story πŸ’€
  • val length : 'a t -> int β€” how many you got, as an int
  • val stats : 'a t -> Hashtbl.statistics β€” hands you back Hashtbl.statistics, the full report card ⭐
  • val add_seq : 'a t -> (key * 'a) Seq.t -> unit β€” feeds a whole (key * 'a) Seq.t of pairs into the table, one by one, slay
  • val replace_seq : 'a t -> (key * 'a) Seq.t -> unit β€” same sequence energy, but replaces as it goes πŸ‘‘
  • val of_seq : (key * 'a) Seq.t -> 'a t β€” builds you a whole new table from a (key * 'a) Seq.t. chef's kiss, table out of thin air πŸ”₯

🧹 the two special ones

  • val clean : 'a t -> unit β€” removes all dead bindings. and girl, don't stress about calling it: this happens automatically during automatic resizing anyway 🫢 so it's giving "optional maintenance, but make it cute".
  • val stats_alive : 'a t -> Hashtbl.statistics β€” same as Hashtbl.SeededS.stats (yes, exactly that one) but it only counts the alive bindings. the dead ones get filtered out of the census πŸ’€βœ¨
⚠️ quick vibe check: this whole thing is a weak hash table β€” bindings can disappear when the GC decides they're not the moment anymore. that's not a bug, that's the entire point. don't come for me when find doesn't find something you "definitely added", bestie 😭

and that's the page!! πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

this absolute icon of a manpage was brought to you by OCamldoc, dated 2026-06-22. go forth and hash weakly, my love πŸŒˆπŸ‘‘

πŸ“¦ where this page comes from