λ SCHEME RUNE DIFFICULTY: Apprentice Behavioral

The Command

Encapsulating spells as deferred, executable scrolls.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Command
ARCANUM SCHOOL: Enchantment // Compulsion
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// SCHEME PATTERN //
(define (make-spell-scroll spell target)
  (lambda () (spell target)))

(define (cast-doom target)
  (display (string-append "Doom falls upon " target "\n")))

(define scroll-of-doom (make-spell-scroll cast-doom "The Lich"))

;; Later...
(scroll-of-doom)

By utilizing zero-argument closures (thunks), we encode an entire spell matrix into a single scroll to be unrolled at a later time.

Runic Tags: #behavioral #scheme #thunks #lazy-evaluation