SICP:2,4 序对的过程性表示方法
Here are the fully expand steps:
0) at the beginning , we get expression ``(car (cons 1 2))``
1) replace ``cons`` using ``(lambda (m) (m x y))`` , we get ``(car (lambda (m) (m x y))`` .
2) replace ``car`` using ``(lambda (z) (z (lambda (p q) p)``, we get :
((lambda (z) (z (lambda (p q) p))
__(lambda (m) (m 1 2)))
3) replace ``z`` using ``(lambda (m) (m 1 2))`` , we get :
((lambda (m) (m 1 2))
__(lambda (p q) p))
4) replace ``m`` using ``(lambda (p q) p)`` , we get :
((lambda (p q) p)
__1 2)
5) replace ``p`` and ``q`` using ``1`` and ``2, we get :
(lambda (1 2) 1)
6) finally, the answer of the expression is ``1``
posted on 2015-04-08 22:52 Zachary_wiz 阅读(128) 评论(0) 编辑 收藏 举报