🌐 REASONML PACT DIFFICULTY: Apprentice Creational

Prototype in ReasonML

Cloning arcane state through structural sharing.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Illusion // Duplication
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// REASON PATTERN //
type grimoire = { spells: list(string), owner: string };
let baseGrimoire = { spells: ["Levitate"], owner: "Unknown" };
let cloneFor = (newOwner, g) => { ...g, owner: newOwner };

let thothsGrimoire = baseGrimoire |> cloneFor("Thoth");

In the immutable realms of OCaml and Reason, the Prototype pattern is effortless. The spread operator clones records with structural sharing, minimizing mana cost.

Runic Tags: #reason #prototype #creational