<br><br><div class="gmail_quote">On Sun, Jan 2, 2011 at 2:05 PM, Todd O'Bryan <span dir="ltr"><<a href="mailto:toddobryan@gmail.com">toddobryan@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;">
I believe Stephen was suggesting something like:<br>
<br>
; net-pay: number -> number<br>
; given gross pay, produces net pay<br>
(define (net-pay gross-pay)<br>
(- gross-pay (tax gross-pay)))<br>
<div><div></div><div class="h5"><br>
<br>
On Sat, Jan 1, 2011 at 7:22 PM, Sayth Renshaw <<a href="mailto:flebber.crue@gmail.com">flebber.crue@gmail.com</a>> wrote:<br>
><br>
><br>
> On Sun, Jan 2, 2011 at 6:05 AM, Stephen Bloch <<a href="mailto:sbloch@adelphi.edu">sbloch@adelphi.edu</a>> wrote:<br>
>><br>
>> Another solution, which doesn't require any language features you don't<br>
>> know yet, is to write a helper function that takes in the gross pay and<br>
>> computes the net pay from it. Your main function then calls this new helper<br>
>> function on the result of your "pay" function. The "pay" function is called<br>
>> only once, and your new helper uses the result twice.<br>
>><br>
>> Stephen Bloch<br>
>> <a href="mailto:sbloch@adelphi.edu">sbloch@adelphi.edu</a><br>
><br>
> I can't quite get it to happen at the moment. But is this more the style you<br>
> were referring to...However it doesn't like me embedding one function in the<br>
> definition of another. will have to keep thinking :-)<br>
><br>
> (define (netpay hours)<br>
> (* 12 hours))<br>
><br>
> (define (tax (netpay hours))<br>
> (cond<br>
> [(<= netpay 240) 0]<br>
> [(<= netpay 480) (* 0.15 netpay)]<br>
> [(> netpay 480) (* 0.28 netpay)]))<br>
><br>
> (define (mypay hours)<br>
> (- (netpay hours)(tax hours)))<br>
><br>
</div></div><div><div></div><div class="h5">> _________________________________________________<br>
> For list-related administrative tasks:<br>
> <a href="http://lists.racket-lang.org/listinfo/users" target="_blank">http://lists.racket-lang.org/listinfo/users</a><br>
><br>
</div></div></blockquote></div><br>; net-pay: number -> number<br>
; given gross pay, produces net pay<br>
(define (net-pay gross-pay)<br>
(- gross-pay (tax gross-pay)))<br><br>Ah okay, I was using hours as the only user input to have a whole function calculate netpay of one input. <br><br><br>