Reading Notes of SICP_02 Episode on Church Numerals
来源:互联网 发布:php中文网有手机版吗 编辑:程序博客网 时间:2024/06/05 15:23
Here comes the exercise 2.6 from SICP,about Church Numerals--really make numbers into functions amazingly and beautifully !
In case representing pairs as procedures wasn't mind-boggling enough, consider that, in a language that can manipulate procedures, we can get by without numbers (at least insofar as non-negative integers are concerned) by implementing 0 and the operation of adding 1 as
(define zero (lambda (f) (lambda (x) x))) (define (add-1 n) (lambda (f) (lambda (x) (f ((n f) x)))))
This representation is known as Church numerals, after its inventor, Alonzo Church, the logician who invented the <math>\lambda</math> calculus.
Define one and two directly (not in terms of zero and add-1). (Hint: Use substitution to evaluate (add-1 zero)). Give a direct definition of the addition procedure + (not in terms of repeated application of add-1).
First time I work on this problem,I was really confused,even if I got couple answers of this problem,so I took a note to analyse :
church数:
(数字是函数)
zero:
zero是一个函数 F1。
F1需要参数 f ~~so~~-->问题的关键在于参数 f~~
F1:
只包含了一个返回自己的函数
add-1:
是一个需要参数 n 的函数-->n也是一个函数
里面包含了一个函数 F1
F1需要参数 f-->是一个函数
包含一个函数F2
F2 需要参数 x
F2 调用函数 f--调用了上面的参数 x,n
f 的参数是 【(n f) x】-->这是一个以 x 为参数的复合函数
~~so~~ add-1 是需要函数 f 和函数 n 的函数
-->函数 f 是关键~~
key of all:把 f 当成黑箱处理以上问题~~
then,when looking at other guy's answers ,this thing become easier~~
They define the fuction f first~~
and the real thing about Church Numerals is how many times your number execute f~~
the following things about this theory is clearly discussed on other master's page ,like
http://jlongster.com/2011/12/16/sicp-26-church-notation.html
and an amazing guy named GenWang goes deep into this theory and discussed more about it
http://docs.huihoo.com/homepage/shredderyin/wiki/ChurchNumber.html
- Reading Notes of SICP_02 Episode on Church Numerals
- HW--Church numerals
- Reading notes on <The Art of Unix Programming>(1)
- Church Numerals: Approaches In Scheme
- Reading Notes of SICP_01
- Reading Notes on NS2(1)
- Reading Notes on NS2(2)
- Reading Notes on NS2(3)
- Reading Notes on NS2(4)
- Reading Notes on NS2(5)
- Reading Notes on NS2(6)
- Reading Notes on NS2(7)
- Reading Notes on NS2(8)
- Reading Notes on NS2(9)
- Reading Notes on NS2(10)
- Reading Notes on NS2(11)
- Reading Notes on NS2(12)
- Reading Notes on NS2(13)
- 不用比较运算符,判断int型的a,b两数的大小的答案
- Eclipse安装SVN插件方式简明介绍
- 执行mapreduce的几种方式
- 编译Android系统32位出错
- 一个误解: 单个服务器程序可承受最大连接数“理论”上是“65535”
- Reading Notes of SICP_02 Episode on Church Numerals
- 一个for mac os x 的 usb无线驱动的开发流程
- ASP.NET中的TreeView控件的使用
- Linux From Scratch - Version 7.2 All Packages
- android binder 原理图
- 三菱PLC编程-MOV指令
- C#+Emgu实现人脸检测
- java 调用oracle存储过程
- TextView Html