您的位置:首页 > 大数据 > 人工智能

【SICP练习】113 练习3.33

2015-09-08 00:00 405 查看

练习3-33

原文

Exercise 3.33. Using primitive multiplier, adder, and constant constraints, define a procedure averager that takes three connectors a, b, and c as inputs and establishes the constraint that the value of c is the average of the values of a and b.

代码

(define (averager a b c) (let ((sum (make-connector)) (d (make-connector))) (adder a b sum) (multiplier sum d c) (constant (/ 1 2) d) 'ok))


感谢访问,希望对您有所帮助。 欢迎关注或收藏、评论或点赞。

为使本文得到斧正和提问,转载请注明出处:
http://blog.csdn.net/nomasp

版权声明:本文为 NoMasp柯于旺 原创文章,未经许可严禁转载!欢迎访问我的博客:http://blog.csdn.net/nomasp
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息