<br><br><div class="gmail_quote">On Wed, Dec 22, 2010 at 11:54 AM, Sayth Renshaw <span dir="ltr"><<a href="mailto:flebber.crue@gmail.com">flebber.crue@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5"><br><br><div class="gmail_quote">On Wed, Dec 22, 2010 at 11:39 AM, Sam Griff <span dir="ltr"><<a href="mailto:sgriff89@gmail.com" target="_blank">sgriff89@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>You need to start over and slow down because you are getting the basic Scheme syntax wrong. <br>The gross pay function is already given:<br>(define (wage h)<br> (* 12 h))<br><br>You could modify it according to the previous suggestions to make it more readable:<br>
; By convention constants are named in upper case<br> (define TAX-RATE 0.15)<br> (define PAY-RATE 12)<br><br>(define (wage h)<br> (* PAY-RATE h))<br><br>Where did your tax function go? How could you use tax and wage to develop netpay? <br>
<br>Your attempt:<div><br> (define (gross hours)<br> (* hours pay-rate))<br> <br> (define (netpay gross tax-rate)<br> (-(gross)(* gross tax-rate)))<br><br></div>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?<br>
<br>Also:<div><br>(define (netpay hours : number? tax : 0.85)<br> (* hours 12)* tax)<br><br></div>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.<br>
</blockquote></div><br></div></div>The main problem I am having is that I followed the examples in the book without issue until I hit this example, something about it is throuwing me.<br><br>To cover off Danny's post <br>
<br>the error I am seeing is<div class="im"><br>
<br>f<i>unction call: expected a defined function name or a primitive operation name after an open parenthesis, but found a function argument name</i><br><br></div>I will explain in numbers what i expect gross to do and maybe that will make my operation clearer. I had defined gross as hours multiply pay rate.<br>
<br>So pay rate in example was $12 and lets say I worked 20 hrs. my gross = 240<div class="im"><br><br> (define (netpay gross tax-rate)<br> (-(gross)(* gross tax-rate)))<br><br></div>So I expect the function to calculate as<br>
<br>= (-(240)(* 240 0.15)<br>
= ( - 240 36)<br>= 204<br><br><br><br>
</blockquote></div><br>