[racket] Solved Re: Order of Operations - Getting the brackets.

From: sayth (flebber.crue at gmail.com)
Date: Wed Dec 22 06:39:18 EST 2010

Sayth Renshaw <flebber.crue at ...> writes:

> 
> What I am having trouble navigating is the brackets.Simply in normal math what
I am trying to do is(people * ticket price)-((number of shows * 20)+(people *
cost per person))Contrcat : total profit : attendees performance -> number;;
Purpose to calculate total profit of a theatre per show ;;Example: (total profit
20 1) should produce $70;;Defintion: ( define (- profit cost))(* patrons 5( - (*
patrons 0.5(+ (* shows 20)))))(define (patrons p)    ;p     a number    ...   
)    (define (shows s)    ;s        a number    ...    )    (define
(total_profit p s)    (* p 5( - (* p 0.5(+ s 20)))))
>     

Took a little bit of tooling but got the brackets right

(define (patrons p)
	;p 	a number
	...
	)
	
(define (shows s)
	;s	a number
	...
	)
	
(define (total_profit p s)
	(- (* p 5)
           (+ (* s 20)(* p 0.5))))




Posted on the users mailing list.