<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=text/html;charset=big5 http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.7600.16535"></HEAD>
<BODY style="PADDING-LEFT: 10px; PADDING-RIGHT: 10px; PADDING-TOP: 15px"
id=MailContainerBody leftMargin=0 topMargin=0 CanvasTabStop="true"
name="Compose message area">
<DIV><FONT size=2 face=新細明體>
<DIV><FONT size=2 face=新細明體>Hello plt-scheme users ,</FONT></DIV>
<DIV><FONT size=2 face=新細明體></FONT> </DIV>
<DIV><FONT size=2 face=新細明體>I am new to scheme and sorry to ask a newbie
question.</FONT></DIV>
<DIV><FONT size=2 face=新細明體></FONT> </DIV>
<DIV><FONT size=2 face=新細明體>I want to let function return the value , for
example , in Drscheme :</FONT></DIV>
<DIV><FONT size=2 face=新細明體></FONT> </DIV>
<DIV><FONT size=2 face=新細明體>>(define add2 (lambda (i) (+ i i)))</FONT></DIV>
<DIV><FONT size=2 face=新細明體>>(add2 2)</FONT></DIV>
<DIV><FONT size=2 face=新細明體>4</FONT></DIV>
<DIV><FONT size=2 face=新細明體></FONT> </DIV>
<DIV><FONT size=2 face=新細明體>I type (add2 2) in command line and it will
return a value 4.</FONT></DIV>
<DIV><FONT size=2 face=新細明體></FONT> </DIV>
<DIV><FONT size=2 face=新細明體>But when I type my function
<EM>foo</EM> in the command line</FONT></DIV>
<DIV><FONT size=2 face=新細明體></FONT> </DIV>
<DIV><FONT size=2 face=新細明體>>(define y '(1 2 3 4))</FONT></DIV>
<DIV><FONT size=2 face=新細明體>>(define dt 1)</FONT></DIV>
<DIV><FONT size=2 face=新細明體>>(define foo<BR>
(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))))</FONT></DIV>
<DIV><FONT size=2 face=新細明體></FONT> </DIV>
<DIV><FONT size=2 face=新細明體>>(foo 0) ---->this should return 1 , but
there is no value to come out.</FONT></DIV>
<DIV><FONT size=2 face=新細明體></FONT> </DIV>
<DIV><FONT size=2 face=新細明體>>(foo 1) ---->this should return
2</FONT></DIV>
<DIV><FONT size=2 face=新細明體>.</FONT></DIV>
<DIV><FONT size=2 face=新細明體>.</FONT></DIV>
<DIV><FONT size=2 face=新細明體>.</FONT></DIV>
<DIV><FONT size=2 face=新細明體>and so on.</FONT></DIV>
<DIV><FONT size=2 face=新細明體></FONT> </DIV>
<DIV><FONT size=2 face=新細明體>Can anyone tell me how to solve this problem ? I
really appreciate your knowledge and hope I won't cause your
inconvenience.</FONT></DIV>
<DIV><FONT size=2 face=新細明體></FONT> </DIV>
<DIV><FONT size=2 face=新細明體>Best Regards ,</FONT></DIV>
<DIV> </DIV></FONT></DIV>
<DIV><FONT size=2 face=新細明體>Hsiu-Hao Tsao</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=新細明體>Master Student</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=新細明體>Ultrafast Photonics Laboratory , <BR>Institute
Photonics of Technologies ,<BR>National Tsing Hua University ,
Taiwan</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2 face=新細明體>Lab : +8863-5715131-34178 <BR>Office :
+8863-5715131-34007<BR>Cell Phone : +886920158033</FONT></DIV></BODY></HTML>