Author: JesterXL

  • Real World Uses of Tacit Programming: Part 2 of 2

    Real World Uses of Tacit Programming: Part 2 of 2

    Introduction

    In our last post, we talked about what Tacit Programming is, how it can help reduce argument count of public API functions using known concrete implementations, and how it can help shrink code size & function count for Array comprehensions and Promise chaining.

    In this post, we’ll show some helpful ways to use tacit programming in data validation & composing functions together synchronously as well as an example of taking things way too far.
    (more…)

  • Real World Uses of Tacit Programming: Part 1 of 2

    Real World Uses of Tacit Programming: Part 1 of 2

    Introduction

    Tacit Programming, also called point-free style, is a way to write functions without specifying the arguments. While functional programming languages have more abilities to leverage this style, there is still two key things you can use point-free style to help with in JavaScript, Python, and Lua that I wanted to cover today. Specifically reducing the amount of arguments for functions, and aiding in composition by writing less code.
    (more…)

  • Promises That Don’t Fail

    Promises That Don’t Fail

    Introduction

    My co-worker, Jason Kaiser, created a way for Promises not to fail, called sureThing. It has 3 benefits to your code that we’ll illustrate below including prior art in other programming languages so you know this isn’t some made-up concept.

    (more…)

  • Pure Function vs. Total Function

    Pure Function vs. Total Function

    A pure function:

    const add = (a, b) => a + b
    

    vs. a total function:

    const addNumbers = (a, b) =>
      ( isNumber(a) && isNumber(b) )
      ? {ok: true, data: a + b}
      : {ok: false, error: new Error(Either a or b aren't Numbers.)}
    

    While same input, same output, no side effects sounds like the end all, be all… it’s not.

    (more…)