using lambda instead of let in scheme
Posted
by Radagaisus
on Stack Overflow
See other posts from Stack Overflow
or by Radagaisus
Published on 2010-05-25T16:39:32Z
Indexed on
2010/05/25
16:41 UTC
Read the original article
Hit count: 210
Hey,
In SICP 1.2.1 there is a function that makes a rational number, as follow:
(define (make-rat n d)
(let ((g (gcd n d)))
(cons (/ n g) (/ d g))))
I'm just curious how you can implement the same thing using lambda instead of let, without calling GCD twice. I couldn't figure it out myself.
© Stack Overflow or respective owner