Skip to main content

🗓️ 02022025 1441
📎

functional_programming

  • Core Idea: FP treats computation as the evaluation of mathematical functions and avoids changing state or mutable data. It emphasizes immutability and pure functions.

  • Key Principles:

    • Pure Functions: Functions that always produce the same output for the same input and have no side effects.

    • Immutability: Data is never modified after creation; instead, new data structures are created.

    • First-Class and Higher-Order Functions: Functions are treated as first-class citizens and can be passed as arguments, returned from other functions, or assigned to variables.

    • Recursion: Iteration is achieved through recursion instead of loops.

  • Use Cases:

    • Data transformation and processing (e.g., data pipelines, analytics).

    • Concurrent and parallel programming (due to immutability and lack of side effects).

  • Examples: Haskell, Lisp, Erlang, Scala, JavaScript (with FP techniques).


References

  • Deepseek