Hello plt-scheme users , I am new to scheme and sorry to ask a newbie question.
I want to let function return the value , for example , in Drscheme : >(define add2 (lambda (i) (+ i i))) >(add2 2) 4 I type (add2 2) in command line and it will return a value 4. But when I type my function foo in the command line >(define y '(1 2 3 4)) >(define dt 1) >(define foo (lambda (t) (do ((i 0 (+ i 1))) ((> i 3)) (if (and (>= t 0) (and (>= t (* i dt)) (< t (* (+ i 1) dt)))) (list-ref y i) #f)))) >(foo 0) ---->this should return 1 , but there is no value to come out. >(foo 1) ---->this should return 2 . . . and so on. Can anyone tell me how to solve this problem ? I really appreciate your knowledge and hope I won't cause your inconvenience. Best Regards , Hsiu-Hao Tsao Master Student Ultrafast Photonics Laboratory , Institute Photonics of Technologies , National Tsing Hua University , Taiwan Lab : +8863-5715131-34178 Office : +8863-5715131-34007 Cell Phone : +886920158033