The Observer of the Scrying Orb
Notifying bound disciples when the orb reveals a new vision.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Observer
ARCANUM SCHOOL: Divination // Scrying
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
module Observer
type event = string
type observer = event -> string
type subject = {
observers: list observer;
}
let notify_all (sub: subject) (e: event) : list string =
let rec map_obs obs =
match obs with
| [] -> []
| h :: t -> h e :: map_obs t
in map_obs sub.observers
A purely functional approach to the Observer pattern, mapping an event stream over a list of scrying functions.
Runic Tags:
#observer
#events
#scrying