Monday, 9 September 2013

Let Statement/Random Function in Scheme

Let Statement/Random Function in Scheme

I was wondering if I would be able to use the built in let function from
scheme to define two random variables within the function without their
values changing throughout the code. For example if I wrote:
(let (x (- (* 2 (random)) 1)))
(let (y (- (* 2 (random)) 1)))
Would the value of x be constant until the function exits? I want to
square x and y and take the square root of them, but I need their values
to remain the same.

No comments:

Post a Comment