Fixed Point Explorer is a multi-implementation exploration of the Y combinator and fixed-point recursion patterns in Scheme. The project demonstrates how recursive functions can be built without explicit self-reference, using the Y combinator as a foundation.
- β¨ Portable Y combinator implementation working across multiple Scheme dialects
- π― Pure functional implementations of classic recursive algorithms
- π§ Support for GNU Guile, Chez Scheme, and Racket
- π Performance benchmarks and comparisons
- π§ͺ Comprehensive test suite with edge case coverage
- π Literate programming approach with Org-mode
- π Formal verification capabilities (Lean 4 support)
Check that you have the required dependencies:
gmake deps# Run all tests
gmake test
# Run tests for specific implementation
gmake test-guile # Primary implementation
gmake test-chez
gmake test-racket# Start Guile REPL with project loaded
gmake repl-guile
# In the REPL, try:
(load "src/portable/fibonacci.scm")
(fib 10) ;; => 55
(test-fibonacci)fixed-point-explorer/ βββ src/ β βββ portable/ # Cross-implementation code β β βββ y-combinator.scm β β βββ fibonacci.scm β β βββ list-ops.scm β βββ guile/ # Guile-specific extensions β βββ chez/ # Chez-specific optimizations β βββ racket/ # Racket-specific typed versions βββ test/ β βββ test-framework.scm β βββ integration/ # Cross-implementation tests βββ scripts/ β βββ deps.sh # Dependency checking β βββ setup.sh # Tool installation βββ lib/geiser/ # Emacs integration βββ docs/ # Documentation βββ Makefile # Build automation
;; Load the Y combinator
(load "src/portable/y-combinator.scm")
;; Define a recursive function using Y combinator
(define CONTINUE-fact
(lambda (f)
(lambda (n)
(if (= n 0)
1
(* n (f (- n 1)))))))
(define factorial (Y-explicit CONTINUE-fact))
(factorial 5) ;; => 120(load "src/portable/fibonacci.scm")
;; Basic fibonacci
(fib 20) ;; => 6765
;; Memoized version for better performance
(define memo-fib (make-memoized-fib))
(memo-fib 100) ;; Computes quickly(load "src/portable/list-ops.scm")
;; All list operations implemented using Y combinator
(append-y '(1 2 3) '(4 5 6)) ;; => (1 2 3 4 5 6)
(map-y (lambda (x) (* x 2)) '(1 2 3)) ;; => (2 4 6)
(filter-y even? '(1 2 3 4 5 6)) ;; => (2 4 6)
(foldr-y + 0 '(1 2 3 4 5)) ;; => 15The Y combinator, discovered by Haskell Curry, enables recursion in languages that donβt have built-in recursion. Its type signature is:
Y : βΞ±. ((Ξ± β Ξ±) β (Ξ± β Ξ±)) β (Ξ± β Ξ±)
This project explores practical applications of this theoretical construct across different Scheme implementations.
GNU Guile 3.0+ is the primary development platform. All portable code is tested first on Guile.
- Uses
string-containsfor implementation detection - Supports performance timing with
(ice-9 time) - Compatible with Geiser for interactive development
The portable code avoids implementation-specific features:
- No
formatin core modules (for maximum compatibility) - Simple list-based memoization instead of hash tables
- Explicit module loading with
loadinstead of module systems
Run benchmarks with:
gmake benchmarkExample output (times vary by system):
- Guile:
fib(30)in ~0.8s - Chez:
fib(30)in ~0.3s - Racket:
fib(30)in ~1.2s
- Clone the repository
- Tangle the literate source (if using
SETUP.org):# In Emacs: C-c C-v t on SETUP.org - Run tests:
gmake test
- Ensure all tests pass:
gmake test - Follow the existing code style
- Add tests for new functionality
- Update documentation as needed
For formal verification with Lean 4:
# Install Lean 4 (FreeBSD with Linux compatibility)
gmake setup
# Or manual installation
gmake -f Makefile.lean lean-installThis project is licensed under the MIT License. See LICENSE for details.
- Y combinator theory from Haskell Curryβs work on combinatory logic
- Inspired by βThe Little Schemerβ and SICP
- Scheme community for maintaining excellent implementations
- Fixed-point combinator (Wikipedia)
- SETUP.org - Literate programming source
- Type Specifications - Formal type documentation
β

