Added section presenting example programs

This commit is contained in:
Justin Ethier 2016-04-13 21:53:06 -04:00
parent 1ba5752582
commit dff146e118
2 changed files with 17 additions and 7 deletions

View file

@ -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 R<sup>7</sup>RS.
- [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).

View file

@ -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))