⚙️ ISABELLE RUNE DIFFICULTY: Adept Structural

The Adapter

Convert the interface of a theory into another interface the clients expect, bridging incompatible realms.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Adapter
ARCANUM SCHOOL: Transmutation // Translation
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// ISABELLE PATTERN //
theory Adapter
  imports Main
begin

record old_spell_system =
  cast_old :: "nat \<Rightarrow> string"

record new_spell_system =
  cast_new :: "int \<Rightarrow> string"

definition adapt_system :: "old_spell_system \<Rightarrow> new_spell_system" where
  "adapt_system old = \<lparr> cast_new = (\<lambda>mana. cast_old old (nat mana)) \<rparr>"

end
Runic Tags: #isabelle #hol #transmutation #design-patterns