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 typeStdlib.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 alwaystype !'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?randomflag, sized by thatintπval clear : 'a t -> unitβ wipes it. gone. empty. no cap.val reset : 'a t -> unitβ the other reset-flavored one, lowkey different fromclear, bothunit-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 keyval 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 optionso 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 simpleval 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 anintval stats : 'a t -> Hashtbl.statisticsβ hands you backHashtbl.statistics, the full report card βval add_seq : 'a t -> (key * 'a) Seq.t -> unitβ feeds a whole(key * 'a) Seq.tof pairs into the table, one by one, slayval 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 asHashtbl.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
- arch rolling: ocaml 5.5.0-1 Β· LGPL2.1 AND custom: QPL-1.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms