infestines
v0.4.11
Published
A minimalistic library to support writing FP libraries
Downloads
24,812
Readme
≡ ▶ Infestines ·
This is a minimalistic library of basic utilities, such as currying, for writing more interesting high performance FP libraries. This library is not intended to be used for application programming. Primitives that are too specialized to be used as a basis for nearly optimal implementations of higher level operations are not provided.
≡ ▶ Contents
- Reference
≡ ▶ Reference
≡ ▶ Currying
≡ ▶ I.arityN(n, (x1, ..., xm) => y) ~> x1 => ... => xn => y
≡ ▶ I.curry((x1, ..., xn) => y) ~> x1 => ... => xn => y
≡ ▶ I.curryN(n, (x1, ..., xn) => y) ~> x1 => ... => xn => y
I.curryN(2, x => {
const x2 = x*x
return y => x2 + y
})(2, 3)
// 7
≡ ▶ Function composition
≡ ▶ I.compose2U(b => c, (a1, ..., aN) => b) ~> a1 => ... aN => c
≡ ▶ I.pipe2U((a1, ..., an) => b, b => c) ~> a1 => ... aN => c
≡ ▶ Sequencing
≡ ▶ I.seq(value, ...fns) ~> value
≡ ▶ I.seqPartial(maybeValue, ...fns) ~> maybeValue
≡ ▶ Basic combinators
≡ ▶ I.always(x) ~> _ => x
≡ ▶ I.applyU(x => y, x) ~> y
≡ ▶ I.id(x) ~> x
≡ ▶ I.sndU(_, x) ~> x
≡ ▶ Constants
≡ ▶ I.array0 ~> []
I.array0
is an
empty
frozen array
[]
.
≡ ▶ I.object0 ~> {}
I.object0
is an
empty
frozen object
{}
.