【SICP练习】113 练习3.33

来源:互联网 发布:apache动静态资源分离 编辑:程序博客网 时间:2024/04/29 03:43

练习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


5 0
原创粉丝点击