diff --git a/README.md b/README.md index 8a4f3e8a..e682b305 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,16 @@ Documentation - Finally, if you need another resource to start learning the Scheme language you may want to try a classic textbook such as [Structure and Interpretation of Computer Programs](https://mitpress.mit.edu/sicp/full-text/book/book.html). +Example Programs +---------------- + +Cyclone provides several example programs, including: + +- [Game of Life](examples/game-of-life) - The game of life example program and libraries from R7RS. +- [Threading](examples/threading) - Various examples of multi-threaded programs. +- [Tail Call Optimization](tail-call-optimization.scm) - A simple example of Scheme tail call optimization; this program runs forever, calling into two mutually recursive functions. +- Finally, the largest program is the compiler itself. Most of the code is compiled into a series of libraries which are used by [`cyclone.scm`](cyclone.scm) and [`icyc.scm`](icyc.scm) to create executables for Cyclone's compiler and interpreter. + License ------- Copyright (C) 2014 [Justin Ethier](http://github.com/justinethier). diff --git a/examples/tail-call-optimization.scm b/examples/tail-call-optimization.scm index 52319355..b024f569 100644 --- a/examples/tail-call-optimization.scm +++ b/examples/tail-call-optimization.scm @@ -1,11 +1,11 @@ ;; This should run forever using a constant amount of memory ;; and max CPU: -;; Original program: -;; (define (foo) (bar)) -;; (define (bar) (foo)) -;; (foo) +(define (foo) (bar)) +(define (bar) (foo)) +(foo) -(letrec ((foo (lambda () (bar))) - (bar (lambda () (foo)))) - (foo)) +;; Another way to write it: +;; (letrec ((foo (lambda () (bar))) +;; (bar (lambda () (foo)))) +;; (foo))