Thank you both for your reply. 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?
On Wed, Jun 1, 2011 at 6:24 PM, Shriram Krishnamurthi <[email protected]>wrote: > Also note that if you programmed in the Student Language levels, this > function would be illegal (and it might give you some insight into how > this programming style works). > > On Wed, Jun 1, 2011 at 9:19 PM, Justin Zamora <[email protected]> wrote: > > On Wed, Jun 1, 2011 at 7:22 PM, Yingjian Ma <[email protected]> > wrote: > >> > >> In my question > >> (define (p x) > >> (+ x 10) > >> (* x 10) > >> ) > >> It seems it only executes (* x 10) > > > > No, it executes both of them. It evaluates (+ x 10), then throws away > > the value it just computed. Then it evaluated (* x 10), since that is > > the last expression, the value gets returned as the value of the > > function. When there is more than one expression in a function body, > > all of them get evaluated, but only the last is returned. If you want > > to use the results of both expressions, then you need to use two > > functions, one for each expression, as Shriram said. > > > > Justin > > > > _________________________________________________ > > For list-related administrative tasks: > > http://lists.racket-lang.org/listinfo/users > > >
_________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users

