<div>Thank you both for your reply.</div>
<div> </div>
<div>My real need is to use the result of the first function in the second function. Is there a standard way to pass a variable into the next function? <br><br></div>
<div class="gmail_quote">On Wed, Jun 1, 2011 at 6:24 PM, Shriram Krishnamurthi <span dir="ltr"><<a href="mailto:sk@cs.brown.edu">sk@cs.brown.edu</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Also note that if you programmed in the Student Language levels, this<br>function would be illegal (and it might give you some insight into how<br>
this programming style works).<br>
<div>
<div></div>
<div class="h5"><br>On Wed, Jun 1, 2011 at 9:19 PM, Justin Zamora <<a href="mailto:justin@zamora.com">justin@zamora.com</a>> wrote:<br>> On Wed, Jun 1, 2011 at 7:22 PM, Yingjian Ma <<a href="mailto:yingjian.ma1955@gmail.com">yingjian.ma1955@gmail.com</a>> wrote:<br>
>><br>>> In my question<br>>> (define (p x)<br>>> (+ x 10)<br>>> (* x 10)<br>>> )<br>>> It seems it only executes (* x 10)<br>><br>> No, it executes both of them. It evaluates (+ x 10), then throws away<br>
> the value it just computed. Then it evaluated (* x 10), since that is<br>> the last expression, the value gets returned as the value of the<br>> function. When there is more than one expression in a function body,<br>
> all of them get evaluated, but only the last is returned. If you want<br>> to use the results of both expressions, then you need to use two<br>> functions, one for each expression, as Shriram said.<br>><br>
> Justin<br>><br></div></div>
<div>
<div></div>
<div class="h5">> _________________________________________________<br>> For list-related administrative tasks:<br>> <a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br>
><br></div></div></blockquote></div><br>