Check in some sample programs demonstrating the compiler.

This commit is contained in:
Jesse D. McDonald 2010-04-20 23:00:12 -05:00
parent cc8dc5d9b6
commit 5c8625a1f1
3 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,5 @@
(letrec ([fact-iter (lambda (n product)
(if (fix> n 1)
(fact-iter (fix- n 1) (fix* n product))
product))])
(fact-iter (string->number (car argv)) 1))

View File

@ -0,0 +1,5 @@
(letrec ([fact (lambda (n)
(if (fix> n 1)
(fix* n (fact (fix- n 1)))
1))])
(fact (string->number (car argv))))

13
src/examples/test.rls Normal file
View File

@ -0,0 +1,13 @@
(let (a [b 3] [c b])
(if (positive? d)
(+ a b c)
(fn d
(begin
(let ((k (lambda () (set! b 5))))
(k))
(set-box! free-var 7)
(set-box! free-var (lambda () 7))
8
(list a (cons b '())))
(cons c (let (e) e)))))