✨ ARCANUM RUNE DIFFICULTY: Apprentice Creational

The Prototype Clone Hex

Replicates arcane artifacts exactly using pure functions and immutable structs.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Illusion // Duplication
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
struct grimoire( title: string, spells: list<string>, mana-cost: int )

fun clone-and-modify(g: grimoire, new-title: string) : grimoire
  g(title = new-title)

pub fun main()
  val original = grimoire("Book of Shadows", ["invisibility", "fear"], 50)
  val copy = clone-and-modify(original, "Book of Deeper Shadows")
  println(copy.title)
Runic Tags: #koka #prototype #immutable