Re: [racket] Basic Racket Question

2010-12-22 Thread Stephen Bloch
On Dec 21, 2010, at 5:43 PM, Sayth Renshaw wrote: > Do i need to define the gross function in my netpay function? No, you don't. You've already defined it by saying (define (gross hours) (* hours pay-rate)) > If I have defined gross function as suggested earlier why can'

Re: [racket] Basic Racket Question

2010-12-22 Thread Robby Findler
Yep. Robby On Tue, Dec 21, 2010 at 11:11 PM, Sayth Renshaw wrote: > > > On Wed, Dec 22, 2010 at 2:04 PM, Robby Findler > wrote: >> >> FWIW, if you were in my class, that solution would get few points. You >> may have noticed people asking you about the design recipe in this >> thread. That is a

Re: [racket] Basic Racket Question

2010-12-21 Thread Sayth Renshaw
On Wed, Dec 22, 2010 at 2:04 PM, Robby Findler wrote: > FWIW, if you were in my class, that solution would get few points. You > may have noticed people asking you about the design recipe in this > thread. That is a reference to this book that you might find useful: > > http://www.htdp.org/ > > R

Re: [racket] Basic Racket Question

2010-12-21 Thread Ken Hegeland
While you got it working, you are over complicating the process. First you defined that variables, that's fine (define tax-rate .15) (define pay-rate 12) The function net-pay only needs one input, the amount of hours you are working. With the defined pay-rate and tax-rate, how would you determi

Re: [racket] Basic Racket Question

2010-12-21 Thread Robby Findler
FWIW, if you were in my class, that solution would get few points. You may have noticed people asking you about the design recipe in this thread. That is a reference to this book that you might find useful: http://www.htdp.org/ Robby On Tue, Dec 21, 2010 at 8:49 PM, Sayth Renshaw wrote: > > >

Re: [racket] Basic Racket Question

2010-12-21 Thread Sayth Renshaw
On Wed, Dec 22, 2010 at 1:19 PM, Sayth Renshaw wrote: > > > On Wed, Dec 22, 2010 at 1:02 PM, Danny Yoo wrote: > >> >> (define (netpay gross tax-rate) >> >>(-(gross)(* gross tax-rate))) >> >> >> >> So I expect the function to calculate as >> >> >> >> = (-(240)(* 240 0.15) >> >> = ( - 240 36)

Re: [racket] Basic Racket Question

2010-12-21 Thread Sayth Renshaw
On Wed, Dec 22, 2010 at 1:02 PM, Danny Yoo wrote: > >> (define (netpay gross tax-rate) > >>(-(gross)(* gross tax-rate))) > >> > >> So I expect the function to calculate as > >> > >> = (-(240)(* 240 0.15) > >> = ( - 240 36) > >> = 204 > > > Just to be more careful: when you're showing the cal

Re: [racket] Basic Racket Question

2010-12-21 Thread Danny Yoo
>>  (define (netpay gross tax-rate) >>    (-(gross)(* gross tax-rate))) >> >> So I expect the function to calculate as >> >> = (-(240)(* 240 0.15) >> = ( - 240 36) >> = 204 Just to be more careful: when you're showing the calculation, make sure to include the use of the function: (netpay 24

Re: [racket] Basic Racket Question

2010-12-21 Thread Sayth Renshaw
On Wed, Dec 22, 2010 at 11:54 AM, Sayth Renshaw wrote: > > > On Wed, Dec 22, 2010 at 11:39 AM, Sam Griff wrote: > >> >> You need to start over and slow down because you are getting the basic >> Scheme syntax wrong. >> The gross pay function is already given: >> (define (wage h) >> (* 12 h)) >> >

Re: [racket] Basic Racket Question

2010-12-21 Thread Sam Griff
You need to start over and slow down because you are getting the basic Scheme syntax wrong. The gross pay function is already given: (define (wage h) (* 12 h)) You could modify it according to the previous suggestions to make it more readable: ; By convention constants are named in upper case (d

Re: [racket] Basic Racket Question

2010-12-21 Thread Danny Yoo
> I am following the book again and your examples but i am rewriting examples > so I am learning it. > > I came to this as a solution based on feeedback but it is erroring on the > word gross as part of my netpay function. Do i need to define the gross > function in my netpay function? > >  (define

Re: [racket] Basic Racket Question

2010-12-21 Thread Sayth Renshaw
On Wed, Dec 22, 2010 at 9:43 AM, Sayth Renshaw wrote: > > > On Wed, Dec 22, 2010 at 2:04 AM, Stephen Bloch wrote: > >> >> On Dec 21, 2010, at 6:50 AM, Sayth Renshaw wrote: >> >> > Doing the netpay of employee tax = 0.15 and pay = hrs *12. From the >> beginner tutorial. I see two ways a simple and

Re: [racket] Basic Racket Question

2010-12-21 Thread Sayth Renshaw
On Wed, Dec 22, 2010 at 2:04 AM, Stephen Bloch wrote: > > On Dec 21, 2010, at 6:50 AM, Sayth Renshaw wrote: > > > Doing the netpay of employee tax = 0.15 and pay = hrs *12. From the > beginner tutorial. I see two ways a simple and a hard way but neither work. > > > > Hard way > > > > (define (ho

Re: [racket] Basic Racket Question

2010-12-21 Thread Stephen Bloch
On Dec 21, 2010, at 6:50 AM, Sayth Renshaw wrote: > Doing the netpay of employee tax = 0.15 and pay = hrs *12. From the beginner > tutorial. I see two ways a simple and a hard way but neither work. > > Hard way > > (define (hours h) > (h : number?)) > (define (tax t) > (= t 0.15)) > (defi

Re: [racket] Basic Racket Question

2010-12-21 Thread Norman Gray
On 2010 Dec 21, at 11:50, Sayth Renshaw wrote: > Doing the netpay of employee tax = 0.15 and pay = hrs *12. From the beginner > tutorial. I see two ways a simple and a hard way but neither work. I think you may need to go a little further back in the tutorial. It looks like you're misunderstan

Re: [racket] Basic Racket Question

2010-12-21 Thread Stephen Bloch
On Dec 21, 2010, at 6:50 AM, Sayth Renshaw wrote: > I am sure I am trying to over define this but not sure how to use other > methods in Racket yet only beginning. So Hi everyone. > > Doing the netpay of employee tax = 0.15 and pay = hrs *12. Follow the recipe. 1) Write a function contract ans