Deterministic

Published: 1/18/2020
Last edited: 1/26/2020

A function which will always return the same output given the same input. As a feature of this, these functions are referentially transparent:

import {curry} from 'ramda'

const times = curry((a, b) => a * b)
const twice = times(2)
const doubleAll = map(twice)
doubleAll([123,345,567]) === [246, 690, 1134]
// you can then work backwards from this:
map(twice)([123,345,567]) === [246, 690, 1134]
map(times(2))([123,345,567]) === [246, 690, 1134]
[
  times(2)(123),
  times(2)(345),
  times(2)(567)
] === [246, 690, 1134]

That was a simple example but this maxim holds true no matter how complex the nested complexity gets. See this review for more examples.

Published: 1/18/2020
Last edited: 1/26/2020
See this page on Github
Built with 💛 by Open Sorcerers
Created with Gatsby using the 😎 foresight starter