I am beginer to scheme. I have function like this:
(define (getRightTriangle A B N) (
cond
[(and (integer? (sqrt (+ (* A A) (* B B)))) (<= (sqrt (+ (* A A) (* B B))) N))
(list (sqrt (+ (* A A) (* B B))) A B)
]
[else (list)]
)
In this function I compute (sqrt (+ (* A A) (* B B))) several times. I want to compute this expression only once in beginning of this function (make constant or variable) but I don't know how...
()should not be matched as if they were curly braces{}in other programming languages. Also, see my answer below for other possible ways to accomplish what you're asking - Óscar López