This commit is contained in:
Justin Ethier 2016-07-04 21:06:11 -04:00
parent 316ac88f16
commit 7591c24886
2 changed files with 0 additions and 44 deletions

View file

@ -1,20 +0,0 @@
;; A temporary test file
;; Notes:
;;Need to be careful about which lambda's we optimize, and ultimately remove
;;paramters from. As a start, we could try to just optimize cases where
;;there is an application of an anonymous lambda. those should be safe
;;to change?
(import (scheme base) (scheme write))
(let ((x 1) (z 3))
(define y 2)
(define w 4)
(write
(+ w x y z)))
(define (test a)
(write 3))
(test 4)

View file

@ -1,24 +0,0 @@
(import (scheme base)
(scheme char)
(scheme file)
(scheme lazy)
(scheme read)
(scheme write)
(scheme eval)
)
(define *num-passed* 0)
(define (assert:equal msg actual expected)
(if (not (equal? actual expected))
(error "Unit test failed [" msg "] actual [" actual "] expected [" expected "]")
(set! *num-passed* (+ *num-passed* 1))))
;; Adder example
(define (make-adder x)
(lambda (y) (+ x y)))
(define decrement (make-adder -1))
(assert:equal "Adder #2" (decrement 42) 41)
(assert:equal "Application example"
((lambda (x) x) (+ 41 1))
42)