☎️ ERLANG HIVE DIFFICULTY: Adept Structural

The Composite of the Hive Switchboard

Process supervision trees acting as one hive mind.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Composite
ARCANUM SCHOOL: Necromancy // Legion
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// ERLANG PATTERN //
-module(the_composite).
-export([broadcast/2]).

broadcast([], _Msg) -> ok;
broadcast([Pid|Rest], Msg) when is_pid(Pid) -> 
    Pid ! Msg,
    broadcast(Rest, Msg);
broadcast([List|Rest], Msg) when is_list(List) ->
    broadcast(List, Msg),
    broadcast(Rest, Msg).

The Composite

The Hive Mind treats an individual spirit (Pid) and a cluster (List of Pids) identically, raining psychic commands across the hierarchy.

Runic Tags: #erlang #actors #telepathy #switchboard #composite