Related pages:
The program omega is made up of two functions which each take one argument. Each of these functions applies the argument to itself. Omega is then the application of one of these functions to the other:
var omega = (function (f){f(f);})(function (g){g(g);}) ;
Trying to evaluate this code fragment will hang the browser until it decides to terminate the script.
The means by which omega achieves non-termination is self-application, and self-application turns out to be the theoretical source of power for the computational universality of the lambda-calculus.
(Self-application creates a number of issues needing careful handling for logical theories based on the lambda-calculus, but these aren’t a concern when the lambda-calculus is used as the basis of a programming language.)
More specifically, self-application allows the construction of fixed combinators, such as the Y combinator, and these permit the construction of recursive functions without explicit support for recursion.
I’ve also created an article demonstrating the Y combinator and showing how it can be used for memoizing recursive functions.
Related articles
- Church encodings in JavaScript
- JavaScript: Warts and workarounds
- Greasemonkey scripts for NSF's Fastlane
- Multitouch remote for a robot: 200 lines of JavaScript and Python
- By example: Continuation-passing style in JavaScript
- HOWTO: Native iPhone/iPad apps in JavaScript
- Lexical analysis and syntax-highlighting in JavaScript
- Learning JavaScript in small bites, Part 4
- Learning JavaScript in small bites, Part 3
- Learning JavaScript in small bites, Part 2
- Learning JavaScript in small bites, Part 1
- Canvas tag rendering of mathematical functions
- Syllabus management in Javascript
- Greasemonkey scripts to fix the UI on Apply Yourself
- Memoizing recursive functions in Javascript with the Y combinator
- 26 languages in 25 days: Reflections on language design
- 26 languages in 25 days: Strategy, tactics, logistics
- Tree transformations: Desugaring Scheme
- Lexical analysis in Racket
- Grammar: The language of languages (BNF, EBNF, ABNF)
- What is static program analysis?
- Implementing Java as a CESK machine, in Java
- Writing an interpreter, CESK-style
- Order theory for computer scientists
- HOWTO: Translate math into code
- Writing CEK-style interpreters in Haskell
- Closure conversion: How to compile lambda
- How to compile with continuations
- Understand exceptions by implementing them
- A-Normalization: Why and How
- Compiling up to the λ-calculus
- Parsing with derivatives (Yacc is dead: An update)
- 7 lines of code, 3 minutes: Implement a programming language
- Architectures for interpreters
- First-class macros from meta-circular evaluators
- Programming with continuations by example
- Compiling Scheme to C
- Compiling to Java
- Church encodings in Scheme
- Advanced programming languages
- Recommended books and papers for grad students
- Church encodings and the Y Combinator in Python
- Introducing QuickCheck: Number theory and red-black trees
- Understanding and implementing laziness
- Higher-order list operations
- Deleting from Okasaki's red-black trees
- Self-inlining anonymous closures in C++
- Self-inlining anonymous functions in C++
- Lambda-style anonymous functions in C++
- Lambda-calculus in C++ templates
- Lazy-list-based streams in Scala
- An interpreter for Lambdo
- Okasaki red-black tree maps in Scala
Twitter: @mattmight
Instagram: @mattmight
LinkedIn: matthewmight
Mastodon: @mattmight@mathstodon.xyz
Sub-reddit: /r/mattmight