I know this is old wine but it’s just too cool! It elegantly demonstrates closure and higher-order functions in a dozen lines, yet retains the robustness. The “intuitive” idea of storage is totally absent, replaced by the “environment” reserved by the interpreter. The first time I saw this is in the SICP videos.

(define (cons a d)
(lambda (op) (op a d))) (define (car p)
(p (lambda (a d) a))) (define (cdr p)
(p (lambda (a d) d)))

> (car2 (cons2 1 2))
1
> (cdr2 (cons2 1 2))
2
>转自:http://pro.harrypan.net/wp/?p=835

最新文章

  1. 数据库管理工具GUI - PremiumSoft Navicat Premium Enterprise 11.2.15 x86/x64 KEY
  2. jQuery ui autocomplete 与easyUI冲突解决办法(重命名ui的autocomplete 和menu部分)
  3. asp.net mvc ajax 异步刷新例子
  4. PopupWindow事件分发冲突解决
  5. noi 9267 核电站
  6. pentaho kettle svn
  7. Zend Studio下调试PHP的一点注意事项
  8. memcached 简介
  9. POJ 1930
  10. 使用AFNetworking时, 控制器点击返回销毁了, 但还是会执行请求成功或失败的block, 导致野指针异常
  11. Linux定时任务crontab命令使用详解
  12. [编译] 3、在Linux下搭建51单片机的开发烧写环境(makefile版)
  13. C++常用代码优化策略
  14. 导出使用NPOI
  15. (二)windows上使用docker
  16. 微信小程序开发1_资料收集
  17. 阿里云短信发送服务SDK-Python3
  18. 如何用Latex合并多个pdf文件?
  19. dropload.js下拉加载更多
  20. 遍历properties文件

热门文章

  1. SQL Server 2008中增强的"汇总"技巧
  2. PHP安全编程:跨站脚本攻击的防御(转)
  3. Java面试求职之==与equals()差别
  4. Ubuntu常见问题
  5. js select 实现左右传值.html
  6. KMP和扩展KMP【转】
  7. 格雷码(Gray Code)转二进制码(Binary Code)
  8. 将JSON数组显示前台Table中
  9. canvas --> getImageData()
  10. MeasureSpec