Learn

Series

Reading

Explicit Function Arity
FP Quiz - Why doesn't parseInt behave as we expect?
@brekk
¶¶¶¶¶+
Identity Closure
An identity closure refers to a function which calls another function and returns the result, usually doing no intermediary translation.
Using Side-Effects to Inspect Data
How can we take a look at data in a composed pipeline?
Problematic imperative code
As we're trying to move towards cleaner and simpler code through FP, how can we identify code that needs to be cleaned up in transition?
@brekk
¶¶¶¶¶+

Reviews

nps
📦
nps is one of the first packages I go to whenever creating a new module. It is a wonderful solution to the limits of package.json and the need to have build scripts. It offers a number of simple solutions out of the box, and even more if you use nps-utils as well. Once you've installed it, you can create a file called package-scripts.js (there is also a YAML flavor which is nice until your scripts get verbose…
ramda
📦
ramda is essential. If I'm going to write any code of any real utility, I'm most likely to reach for ramda to create clean transformational pipelines. All of its functions are automatically curried and it never mutates data. Part of what I really like about it is that you can use it to compose simple and pure functions to get great complexity. Look at how each function in the capitalize function below is pure…

Glossary

Arity
The number of parameters a function takes.
Binary
A function which takes two parameters, or is said to have an arity of 2.
Combinator
A combinator is a primitive higher-order function without free-variables . Often if you can identify combinators in your code, you can use them to simplify logical parts of the code because of a knowledge of certain morphisms . Read much more on wikipedia . (The above definitions provided by this gist .) (A common reference is To Mock A Mockingbird but your mileage may vary.) There's a lot more to read…
¶¶¶¶¶+
Composition
An operation which takes two or more functions and returns a unary function. Function composition facilitates code re-use.
¶¶
Constant
The constant function takes what it is given and returns a nullary function which returns the original value. Sometimes called always or the K combinator.
Curry
Currying is a way of modifying a given function which takes multiple arguments in to a sequence of unary functions. Specifically, in JS, it means that you can manipulate arguments, their order, and other facets of a passed in function. Modules
¶¶¶
Deterministic
A function which will always return the same output given the same input. As a feature of this, these functions are referentially transparent : That was a simple example but this maxim holds true no matter how complex the nested complexity gets. See this review for more examples.
¶¶
Free-Variable
A free-variable is a global variable or variable defined externally to the function. You can use the free-variable partial-application pattern to fix this problem and turn this function pure : If the above seems overkill, or needless, just remember that a runtime error can crash everything in JS land and a free benefit of the pattern is that you get the ability to inject mocks into your tests (e.g. const save…
¶¶¶
Function
A relationship or expression involving one or more variables.
Higher-Order Function
A function which takes a function and possible additional parameters, and returns a function.
Identity
The identity function returns what it is given. Sometimes referenced as the I combinator.
Nullary
A function which takes zero parameters, or is said to have an arity of 0.
Purity
A pure function is deterministic , has no side-effects and is referentially transparent .
Referential Transparency
A function which (when invoked with all inputs) can be replaced in all instances without changing the program's behavior.
Side-Effect
A side-effect is something which is external to the body of the current function (often in the form of a function call whose value is not captured).
Ternary
A function which takes three parameters, or is said to have an arity of 3.
Unary
A function which takes one parameter, or is said to have an arity of 1.

For more content elsewhere, please checkout our References page.

See this page on Github
Built with 💛 by Open Sorcerers
Created with Gatsby using the 😎 foresight starter