🥞 FORTH STACK DIFFICULTY: Adept Creational

Builder (Forth)

Piece together a chimera on the data stack, limb by limb.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Builder
ARCANUM SCHOOL: Transmutation // Fleshcrafting
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// FORTH PATTERN //
\ Fleshcrafting: The Builder Pattern
\ Instead of complex constructors, we mutate a structure iteratively.

VARIABLE CHIMERA-STATE

: NEW-CHIMERA ( -- )
  0 CHIMERA-STATE ! ." A formless mass is prepared." CR ;

: ADD-CLAWS ( -- )
  CHIMERA-STATE @ 1+ CHIMERA-STATE ! ." Claws grafted." CR ;

: ADD-WINGS ( -- )
  CHIMERA-STATE @ 2 + CHIMERA-STATE ! ." Wings bound." CR ;

: AWAKEN ( -- )
  ." The Chimera breathes. Power level: " CHIMERA-STATE @ . CR ;

\ Usage:
\ NEW-CHIMERA ADD-CLAWS ADD-WINGS AWAKEN

The Builder pattern in Forth is pure fluent interface. As words execute sequentially, they pull the developing construct from the stack or global state, shape it, and leave it ready for the next invocation.

Runic Tags: #creational #builder #forth #fleshcrafting