functional-programmingclojurelet-binding

Is assignment with "let" not against the idea of functional programming in Clojure


Assignment should avoided in functional programming, but in clojure we often use let.

Is let just a way of being practical or is assignment not the same as using let? Should we not avoid assignment in functional programming?


Solution

  • Mutable state is generally against the core concepts of functional programming.

    However, let merely binds a name to a value. If that value is immutable, there's no reason for it to be inconsistent with functional programming ideals.