[racket] novice question about expressions

From: Jos Koot (jos.koot at gmail.com)
Date: Sat Jan 12 15:12:40 EST 2013

Assuming Jamel does a self study.
I think Jamel ment (/ (+ (* n n) 300) (* 13 n)).
Grant, with your definition:
(define (f n) ( +  ( * n 2 ) 300))
(f 5) -> 310
As Jamel is expecting 325, I assume n*2 is ment as an exponentiation.
 
There are many ways to write this down, for example:
 
(define (f n) (/ (+ (expt n 2) 300) (* 13 n)))
(define (f n) (/ (+ (* n n) 300) 13 n))
(define (f n) (/ (+ (expt n 2) 300) 13 n))
 
Jos

  _____  

From: users-bounces at racket-lang.org [mailto:users-bounces at racket-lang.org]
On Behalf Of Grant Rettke
Sent: sábado, 12 de enero de 2013 20:38
To: Jamel Hamani
Cc: users at racket-lang.org
Subject: Re: [racket] novice question about expressions


(/ (+ (* n 2) 300) (* 13 n))

On Fri, Jan 11, 2013 at 8:08 PM, Jamel Hamani <jamelhamani at gmail.com> wrote:


(n*2+ 300) / (13n)





-- 
Grant Rettke | ACM, AMA, COG, IEEE
grettke at acm.org | http://www.wisdomandwonder.com/
Wisdom begins in wonder.
((λ (x) (x x)) (λ (x) (x x))) 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130112/9d87073c/attachment-0001.html>

Posted on the users mailing list.