LISP习题练习
请定义一个过程,它以三个数为参数,返回其中较大的两个数之和
(define (square x (* x x))
(define (sum-of-squares x y (+ (square x) (square y)))
(define (sum-of-max-2-of-3 x y z)
(cond (and (<= x y) (< x z)) (+ y z)
(and (<= y x) (< y z)) (+ y z)
(and (<= z y) (< z x)) (+ y z)
)
)
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 loekr
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果
Steam卡片