知识种类

关于只是大致可以分为how, what, why这3中知识。 也就是所谓的"知、行、观"​​​​​

what表示的是知识是什么,通过声明式的表示方法来表示知识

what表示的如何实现知识,​​​​​​​​​​​​​​​属于工具类的知识,表示对知识的探索过程

why表示的知识存在理由,是知识的充分条件

Computer science is dealing with a different kind of knowledge -- Imperative or

"how to" knowledge. It is trying to capture the notion of a

process that causes information to evolve from one state to

another, and we want to see how we can use methods to capture the knowledge

一个命令式知识的公共模式

1:做一个猜测

2:检验猜测是否正确(检验正确时就需要what之类的知识)

3:如果正确的话,则找到结果

4:如果不正确的话,换另外一个猜测(或者在现有猜测上进行改进),跳转到第2步,直至找到正确的答案

5:最重要的是猜测的改进算法,如果不能有效的改进猜测的话,那效率将是很低的


把这个模式实例化就是计算平方根的过程​



(defn sq

[x]

(letfn [ (abs [x] (if (< x 0) (- x) x)) (improve [guess]

(/ (+ (/ x guess) guess) 2))

(good? [guess]

(< (abs (- (* guess guess) x)) 0.001))

(sq-iter [guess]

(if (good? guess)

guess

(recur (improve guess))))]

(sq-iter (/ x 2))))
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值