嘿,我正在尝试写一些方案,您能帮我吗?
(define (square a b) (+ (* a a) (* b b)))
(define (sumsq x y z)
(cond (and (< x y) (< x z) (square y z))
(and (< y x) (< y z) (square x z))
(else (square y z))))
(sumsq 1 2 3)
它给我一个错误;Syntactic keyword may not be used as an expression: #[keyword-value-item 13]
答案 0 :(得分:3)
缺少两个括号。这是cond
的正确语法:
(define (sumsq x y z)
(cond ((and (< x y) (< x z)) (square y z))
((and (< y x) (< y z)) (square x z))
(else (square y z))))