-
-
Notifications
You must be signed in to change notification settings - Fork 86
Combinators
Vladimir Gorej edited this page Dec 25, 2019
·
3 revisions
Ramda have the B, C, K and W from the BCKW system
- B (composition) : R.map or R.compose ✅
- C (flip) : R.flip ✅
- K (known as Prelude#const) : R.always ✅
- W (duplication) : R.unnest ✅
Ramda have S, K and I from the SKI system
- S (substitution) : R.ap ✅
- K (constant, also known as Prelude#const) : R.always ✅
- I (identity) : R.identity ✅
// substitution
const S = curry((f, g, x) => f(x, g(x)));
- A (apply) : R.call (IMHO R.apply is valid too) ✅
- T (thrush) : R.applyTo ✅
- Y (fix-point) : RA.Y (fascinating one) ✅
- P (Psi, also known as Data.Function#on) : ❌
// Psi
const P = curry((f, g, x, y) => f(g(x), g(y)));
We can imagine a variadic arguments version of this one.
Study material - https://gist.github.com/Avaq/1f0636ec5c8d6aed2e45