Skip to content

Instantly share code, notes, and snippets.

@kamocyc
kamocyc / gist:41d94a2d91f80aa90535ed6b5bef021a
Created February 11, 2021 06:17
Y combinator (factorial applied)
=LAMBDA(f,LAMBDA(x,f(LAMBDA(v,x(x)(v))))(LAMBDA(x,f(LAMBDA(v,x(x)(v))))))(LAMBDA(fact,LAMBDA(x,IF(x=0,1,x*fact(x-1)))))(5)
// `is_prime` function
=LAMBDA(n, OR(n = 2, AND(n >= 2, SUM((MOD(n,SEQUENCE(SQRT(n),1,2))=0)+0) = 0)))
// `main` function
=LAMBDA(
current_number,
remaining_nth,
IF(is_prime(current_number),
IF(remaining_nth = 1,
current_number,
const getAttribute = (elem, attributeName) => {
if (attributeName === 'class') {
return elem.className === '' ? undefined : elem.className;
}
else {
return elem[attributeName];
}
};
const hasProperty = (elem, property) => {
if (property.propertyType === 'TagName' || property.propertyType === 'InnerText')