Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试从头开始在 scheme48 中编写 GCD 函数,但不断让该函数进入无限循环。我相信逻辑是正确的——显然我错过了一些东西。任何帮助都会很棒。我也不能在我的解决方案中使用内置函数,如abs()其余部分。
abs()
(define (mygcd a b) (cond ((equal? a b) a) ((> a b) (mygcd (- a b)(b)) (else (mygcd (a)(- b a))))