mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-18 21:29:18 +02:00
Added section presenting example programs
This commit is contained in:
parent
1ba5752582
commit
dff146e118
2 changed files with 17 additions and 7 deletions
10
README.md
10
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 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).
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue