The Command
Encapsulate a logical request as an object, thereby letting you parameterize clients with different requests.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Command
ARCANUM SCHOOL: Abjuration // Imperative
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// ISABELLE PATTERN //
theory Command
imports Main
begin
datatype command =
Teleport "nat * nat"
| Cast "string"
type_synonym state = "nat * nat * string list"
fun execute_command :: "command \<Rightarrow> state \<Rightarrow> state" where
"execute_command (Teleport (x, y)) (_, _, log) = (x, y, log)"
| "execute_command (Cast spell) (x, y, log) = (x, y, spell # log)"
end
Runic Tags:
#isabelle
#hol
#abjuration
#design-patterns