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] else: not allowed as an expression in: else

2010-12-21 Thread Jon Rafkind
On 12/21/2010 05:29 PM, Danny Yoo wrote: > On Tue, Dec 21, 2010 at 3:57 PM, Niitsuma Hirotaka > wrote: >> I try to run this code on racket >> >> http://www.daniweb.com/forums/thread277930.html >> >> After little modify I enables run this code on swindle. >> But when I chose language racket, this c

Re: [racket] else: not allowed as an expression in: else

2010-12-21 Thread Jon Rafkind
If you change from #lang racket to #lang mzscheme your program will work. I'm pretty sure the issue is that eopl was defined in terms of the 'mzscheme' language where `cond' checks for `else' symbolically. The `else' you are using is from the 'racket' language where its defined as a syntactic tran

Re: [racket] else: not allowed as an expression in: else

2010-12-21 Thread Danny Yoo
On Tue, Dec 21, 2010 at 3:57 PM, Niitsuma Hirotaka wrote: > I try to run this code on racket > > http://www.daniweb.com/forums/thread277930.html > > After little modify I enables run this code on swindle. > But when I chose language racket, this code cause error > > else: not allowed as an express

[racket] else: not allowed as an expression in: else

2010-12-21 Thread Niitsuma Hirotaka
I try to run this code on racket http://www.daniweb.com/forums/thread277930.html After little modify I enables run this code on swindle. But when I chose language racket, this code cause error else: not allowed as an expression in: else flowing is the modified code -

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] shootout package

2010-12-21 Thread Neil Van Dyke
Jon Rafkind wrote at 12/21/2010 03:25 PM: So what does COST and COST-GCMS mean? And what does it mean when they are negative? As the documentation implies, only the "RUN" and "RUN-GCMS" numbers are very meaningful in this version. They are, respectively, "how many ms did the iterations t

Re: [racket] shootout package

2010-12-21 Thread Jon Rafkind
So what does COST and COST-GCMS mean? And what does it mean when they are negative? SHOOTOUT-EXPRESSION 1: (va "aaa") SHOOTOUT-TIMING (RUN 277, RUN-GCMS 8, COST -121, COST-GCMS -344, CLEANUP-DIFF -398.0) On 12/21/2010 01:19 PM, Neil Van Dyke wrote: > I just released "shootout", a simple little to

[racket] shootout package

2010-12-21 Thread Neil Van Dyke
I just released "shootout", a simple little tool that's sometimes helpful for quickly comparing the performance of two or more expressions. Don't read too much into the numbers. http://www.neilvandyke.org/racket-shootout/ _ For list-related admi

[racket] equal? and objects

2010-12-21 Thread Eduardo Bellani
I am trying to implement an is-equal? function like this: ;; is-equal? : the-obj -> boolean (define/public (is-equal? another-obj) (andmap (λ (field-name) (equal? (get-field field-name another-obj) field-name)) (field-names this

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] comments requested from users of SXML and PLT xexprs

2010-12-21 Thread Neil Van Dyke
Noel Welsh wrote at 12/21/2010 09:06 AM: On Tue, Dec 21, 2010 at 1:52 PM, Neil Van Dyke wrote: Note that the special syntax of the template library does not and will never permit extraneous nesting in the static (Racket syntax) portions of the template. Extraneous nesting is a convenience

Re: [racket] comments requested from users of SXML and PLT xexprs

2010-12-21 Thread Noel Welsh
On Tue, Dec 21, 2010 at 1:52 PM, Neil Van Dyke wrote: > Note that the special syntax of the template library does not and will never > permit extraneous nesting in the static (Racket syntax) portions of the > template.  Extraneous nesting is a convenience for dynamic parts. Can you expand on this

[racket] comments requested from users of SXML and PLT xexprs

2010-12-21 Thread Neil Van Dyke
Comments requested from anyone who has used SXML or xexprs... I've almost finished a set of new PLaneT packages for a new variation on SXML and PLT xexprs, and am second-guessing one of the design decisions. Originally, my main goal was to unify SXML, PLT xexprs, and SHTML. Part of that invo

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

[racket] Basic Racket Question

2010-12-21 Thread Sayth Renshaw
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. From the beginner tutorial. I see two ways a simple and a hard way but neither work. Hard way (define (hours h