const log = console.log;// zero :: &fa.aconst zero = f => x => x; // zero is F// once :: &fa.faconst once = f => x => f(x); // once it I// twice :: &fa.f(fa)const twice = f => x => f(f(x));// thrice :: &fa.f(f(fa))const thrice = f => x => f(f(f(x)));const T = true;const F = false;const I = x => x;const not = x => !x;log(zero(not)(T)) // true, because only return second arguementlog(once(not)(T)) // falselog(twice(not)(F)) // falselog(thrice(not)(T)) // falselog('****')/** SUCCSOR SUCC N1 = N2SUCC N2 = N3SUCC(SUCC N1) = N3SUCC &fa.fa = &fa.f(fa)SUCC N2, then n is 2, do f n times, then add one f more*/const succ = n => f => x => f(n(f)(x));// conver chunch number to JS number.// jsnum :: take a chunch number, call (x => x + 1) n times, and start from 0.const jsnum = n => n(x => x + 1)(0);log(succ(zero)(not)(T)) // falselog(jsnum(succ(zero))) // 1log(jsnum(succ(succ(zero)))) // 2const n0 = zero;const n1 = once;const n2 = twice;const n3 = thrice;const n4 = succ(thrice);log(jsnum(succ(n2))) // 3