✨ ARCANUM RUNE DIFFICULTY: Adept Behavioral

The Command: Array-Based Operations

Reify operations as sum types to be mapped across the GPU void.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Command
ARCANUM SCHOOL: Divination // Flow
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
type command = #add i32 | #mul i32

let exec (cmd: command) (acc: i32) =
  match cmd
  case #add v -> acc + v
  case #mul v -> acc * v
  
let run_commands [n] (cmds: [n]command) (init: i32) : i32 =
  loop acc = init for c in cmds do exec c acc
Runic Tags: #futhark #command #sum-types