How do GoF patterns apply in functional programming?

Answer

Functional programming languages make many GoF patterns either trivial or unnecessary by using first-class functions and higher-order functions. Strategy becomes passing a function as an argument — no interface or class hierarchy needed. Command becomes a closure that captures context. Template Method becomes a higher-order function that accepts functions for the variable steps. Observer becomes subscribing a callback function or a reactive stream operator. Iterator is built into functional languages as lazy sequences or generators. Decorator maps to function composition — f(g(x)). Patterns like Singleton are avoided by passing dependencies explicitly (pure functions). Factory Method becomes a function that returns a value. The patterns that survive in FP tend to be higher-level architectural ones (Pipeline, Monad as a pattern) rather than the OOP-specific ones the GoF book addresses.