constY=(f)=>((x)=>f((y)=>x(x)(y)))((x)=>f((y)=>x(x)(y)));constF=(a)=>(b)=>b;constT=(a)=>(b)=>a;constzero=(f)=>(x)=>x;constone=(f)=>(x)=>f(x);consttwo=(f)=>(x)=>f(f(x));constthree=(f)=>(x)=>f(f(f(x)));constfour=(f)=>(x)=>f(f(f(f(x))));constfive=(f)=>(x)=>f(f(f(f(f(x)))));constpair=(x)=>(y)=>(z)=>z(x)(y);constleft=(p)=>p((x)=>(y)=>x);constright=(p)=>p((x)=>(y)=>y);constempty=pair(T)(T);constushift=(l)=>(x)=>pair(F)(pair(x)(l));constis_empty=left;constfirst=(l)=>left(right(l));constrest=(l)=>right(right(l));constif_else=(b)=>b;constis_zero=(f)=>f((x)=>F)(T);constis_less_or_equal=(m)=>(n)=>is_zero(minus(m)(n));constsucc=(n)=>(f)=>(x)=>f(n(f)(x));constslide=(p)=>pair(right(p))(succ(right(p)));constpred=(n)=>left(n(slide)(pair(zero)(zero)));constplus=(m)=>(n)=>n(succ)(m);constminus=(m)=>(n)=>n(pred)(m);constmult=(m)=>(n)=>n(plus(m))(zero);constdiv=Y((f)=>(m)=>(n)=>if_else(is_less_or_equal(n)(m))((x)=>succ(f(minus(m)(n))(n))(x))(zero));consta=two;constb=succ(a);constaa=ushift(ushift(empty)(a))(a);constab=ushift(ushift(empty)(b))(a);constabaa=ushift(ushift(aa)(b))(a);constto_boolean=(p)=>if_else(p)("T")("F");constto_char=(c)=>if_else(is_zero(c))("0")(if_else(is_zero(pred(c)))("1")(if_else(is_zero(two(pred)(c)))("a")("b")));constfold=Y((f)=>(l)=>(x)=>(g)=>if_else(is_empty(l))(x)((y)=>g(f(rest(l))(x)(g))(first(l))(y)));constpushs=(l)=>(x)=>fold(l)(ushift(empty)(x))(ushift);constto_digits=Y((f)=>(n)=>pushs(if_else(is_less_or_equal(n)(pred(two)))(empty)((x)=>f(div(n)(two))(x)))(mod(n)(two)));constmod=Y((f)=>(m)=>(n)=>if_else(is_less_or_equal(n)(m))((x)=>f(minus(m)(n))(n)(x))(m));constrange=Y((f)=>(m)=>(n)=>if_else(is_less_or_equal(m)(n))((x)=>ushift(f(succ(m))(n))(m)(x))(empty));constmaps=(k)=>(f)=>fold(k)(empty)((l)=>(x)=>ushift(l)(f(x)));consttwenty=mult(four)(five);constmy_list=maps(range(one)(twenty))((n)=>if_else(is_zero(mod(n)(succ(five))))(abaa)(if_else(is_zero(mod(n)(three)))(aa)(if_else(is_zero(mod(n)(two)))(ab)(to_digits(n)))));// The above code only uses functions to compconste all calculations,
// and the calculation result is a single-character linked list
// But the above code does not encode the characters related to the output format,
// so use an array to store the result to change the output format
constto_array=(proc)=>{constarr=[];while(to_boolean(is_empty(proc))!="T"){arr.push(first(proc));proc=rest(proc);}returnarr;};constto_string=(s)=>to_array(s).map((c)=>to_char(c)).join("");console.log(to_array(my_list).map((v)=>to_string(v)));// If you don’t use arrays, you can also use functions to simulate
constfact=Y((f)=>(n)=>is_zero(n)(one)((x)=>mult(n)(f(pred(n)))(x)));constarr=(s)=>to_char(first(s));consts1=to_digits(fact(four));consts2=rest(s1);consts3=rest(s2);consts4=rest(s3);consts5=rest(s4);// console.log(arr(s1) + arr(s2) + arr(s3) + arr(s4) + arr(s5));