Scheme procedure problem
Posted
by Zun
on Stack Overflow
See other posts from Stack Overflow
or by Zun
Published on 2010-03-31T08:28:43Z
Indexed on
2010/03/31
8:33 UTC
Read the original article
Hit count: 290
I defined the Scheme procedure to return another procedure with 2 parameters :
(define (smooth f)
(?(x dx)(/ (+ (f (- x dx))
(f x)
(f (+ x dx)))
3.0)))
if i run this procedure with sin procedure with 2 arguments 10 and 0.0001 then it is ok
((smooth sin) 10 0.0001) ==> -0.544021109075966
if i run this procedure recursively, then it has error
((smooth (smooth sin)) 10 0.0001)
==> procedure expects 2 arguments, given 1: #<promise:temp6>
So can anyone tell me where is my problem? Thank you in advance !!!
PS:this is apart of exercise 1.44 in SICP
© Stack Overflow or respective owner