Best of Functional ProgrammingAugust 2024

  1. 1
    Article
    Avatar of stitcherstitcher.io·2y

    I don't write code the way I used to

    A seasoned programmer shares reflections on how their coding approach has evolved over the past decade. Key changes include a move away from abstractions, embracing a functional programming mindset, struggling but persisting with testing, opting for readability over shorthand efficiency, and the importance of static analysis tools. Despite the quirks, they continue to find value in using PHP.

  2. 2
    Article
    Avatar of typescripttvTypeScript.TV·2y

    How to write declarative TypeScript Code?

    Declarative programming in TypeScript focuses on defining the desired outcome rather than the specific steps to achieve it. Unlike imperative programming, which details every step and state change, declarative programming relies on abstractions to handle these complexities. An illustrative comparison is made using the example of filtering even numbers from an array, highlighting key differences in control flow, state management, and code focus.

  3. 3
    Article
    Avatar of communityCommunity Picks·2y

    A different way to think about TypeScript

    Think of TypeScript's type system as a functional language that operates over sets. Types can be considered as sets of literals they can construct. By resolving types into sets, intersections and unions become clearer. Primitives in TypeScript allow introspection and transformation of these sets. Mapped types and recursive logic enable advanced type manipulations. Viewing TypeScript through this lens helps to understand and utilize its advanced features better.

  4. 4
    Article
    Avatar of asayerasayer·2y

    Better Error Handling with Monads (Part 1)

    This post explains how to achieve better error handling using monads in JavaScript. It starts with basic containers, progresses to functors, and culminates in monads. The focus is on how to define and use monads to simplify coding tasks, such as dealing with errors and missing values, using vanilla JavaScript without classes.

  5. 5
    Article
    Avatar of bitfieldconsultingBitfield Consulting·2y

    Functional programming in Go — Bitfield Consulting

    Functional programming in Go enhances code organization by using functions as primary control structures. Key operations include mapping a function over a slice, filtering elements based on a function, and reducing a slice to a single value with a function. These operations can simplify and elegantly solve many problems. The post demonstrates how to implement `Map`, `Filter`, and `Reduce` functions in Go, highlighting their usage and versatility.

  6. 6
    Article
    Avatar of asayerasayer·2y

    Forever Functional: Better Error Handling with Monads (Part 2)

    This post elaborates on the practical uses of monads in JavaScript, focusing on the Maybe monad to handle null values and the Either monad for error handling. It illustrates how these monads can simplify code by providing declarative mechanisms to manage optional values and errors, eliminating the need for verbose if-statements. The post provides code examples for both monads and demonstrates a real-life application involving customer data retrieval. Additionally, it introduces the Try monad for exception handling and briefly touches on using promises in a monadic way.

  7. 7
    Article
    Avatar of infoworldInfoWorld·2y

    Functional programming with Java collections

    Streams and lambdas provide powerful ways to work with Java collections, making functional programming easier and more efficient. Java 8 introduced these features, allowing developers to use functional operations like sort, forEach, map, filter, and reduce on collections without modifying the original data. These operations enhance code readability and maintainability by enabling a more declarative syntax and composable pipelines. Additionally, converting different types of collections into streams unlocks the potential for these functional techniques across various data structures.

  8. 8
    Video
    Avatar of awegoAwesome Go·2y

    An Introduction to Functional Programming in Go - Eleanor McHugh, Innovative Identity Solutions

    Eleanor McHugh explores functional programming in Go, discussing the evolution of Go since 2019 and highlighting its support for generics. She shares insights from her diverse career and emphasizes the importance of mutable state in functional programming. McHugh also delves into detailed examples, including mathematical functions and the power of closures. She concludes with an advanced exploration of higher-order functions and the Y combinator, illustrating how Go can efficiently handle recursion and state management in a functional programming context.