Skip to content

giokoguashvili/Church-Encoding

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Church Encoding

🔥 The Factorial function as a one-line expression, without mathematical operators, executed with parameter 7, is used only:

  • Lambda Calculus (Terms, Reduction Operators)
  • Church Encoding

You can run copy & paste it in browser console and see result

(_ => _(__ => __ + 1)(0))(((_____________________________________ => (______________________________________ => _____________________________________(_______________________________________ => ______________________________________(______________________________________)(_______________________________________)))(______________________________________ => _____________________________________(_______________________________________ => ______________________________________(______________________________________)(_______________________________________))))(_________________________________ => __________________________________ => (______________________________ => _______________________________ => ________________________________ => ______________________________(_______________________________)(________________________________)())((_________ => _________(__________ => _______ => ________ => ________)(_____ => ______ => _____))(__________________________________))(___________________________________ => ___ => ____ => ___(____))(____________________________________ => (_________________________ => __________________________ => __________________________((___________________ => ____________________ => _____________________ => ______________________ => ____________________(_____________________)(___________________(_____________________)(______________________)))(_________________________))(_ => __ => __))(__________________________________)(_________________________________((_______________________ => (______________ => ______________(_____ => ______ => _____))( _______________________(________________________ => (___________ => ____________ => _____________ => _____________(___________)(____________))( (_______________ => _______________(_______ => ________ => ________))(________________________))( (________________ => _________________ => __________________ => _________________(________________(_________________)(__________________)))((_______________ => _______________(_______ => ________ => ________))(________________________)))) ((___________ => ____________ => _____________ => _____________(___________)(____________))(_ => __ => __)(_ => __ => __))))(__________________________________))))))(_ => __ => _(_(_(_(_(_(_(__)))))))))

Console:

> 5040

🤯 Lambda Calculus is Turing Complete, and we can build whole FP & OOP paradigms on it

🌐 Example of Y-Combinator on Stackoverflow
🌐 Source code on GitHub, you can see how it works

#lambda #church #ycombinator #factorial

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published