Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
;; $Id: apply.tst,v 1.8 2006/10/23 20:44:08 leavens Exp leavens $
(newline)
(displayln "Test case $RCSfile: apply.tst,v $ of $Date: 2006/10/23 20:44:08 $")
(newline)
;; Check that procedures are represented as expressed values
(run-test-case '(run "proc(x) x"))
(run-test-case '(run "apply(proc(x) x, list(proc(y) y))"))
(run-regression-tests-equal?
`(
( (run "let double = proc(z) *(z,2)
in apply(double, list(3))")
==> 6 )
( (run "+(4, let double = proc(z) *(z,2)
in apply(double, list(3)))")
==> 10 )
( (run "let makemult = proc (maker, x)
if x
then +(4, apply(maker, list(maker, -(x,1))))
else 0
in let times4 = proc (x) apply(makemult, list(makemult, x))
in apply(times4, list(3))")
==> 12 )
)
)