variadic-y
Variadic y-combinator for recursive anonymous functions.
Installation
npm i variadic-y
Usage
Define your recursive function to take in a reference to itself. Here, f
.
; Yx == 1 ? y : fx - 1, x * y5; // 120
Design
Unmemoized to enable usage with objects and referentially opaque functions.
;
If anyone knows how to properly type this combinator in TypeScript, let me know.