[racket] Basic Racket Question

From: Sam Griff (sgriff89 at gmail.com)
Date: Tue Dec 21 19:39:15 EST 2010

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
; By convention constants are named in upper case
 (define TAX-RATE 0.15)
 (define PAY-RATE 12)

(define (wage h)
 (* PAY-RATE h))

Where did your tax function go? How could you use tax and wage to develop

Your attempt:
 (define (gross hours)
   (* hours pay-rate))

 (define (netpay gross tax-rate)
   (-(gross)(* gross tax-rate)))

Has a few major issues: 1) You have defined gross to take one argument but
when you "call" it from (my 2nd point) you have provided no arguments and 2)
you have named a "gross" parameter in netpay and use it twice. Which "gross"
do you think is being used? The function or the passed value?

(define (netpay hours : number? tax : 0.85)
  (* hours 12)* tax)

Where did you get that syntax from? Follow the examples in the book.
Additionally, that is not even the right formula for computing netpay.
Follow the development of functions for the exercise exactly and the proper
formula should be clear.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20101221/d506f6a3/attachment.html>

Posted on the users mailing list.