[2013-01-15]The Little Schemer 学习笔记
《The Little Schemer》 FP编程、lisp入门必备
该书大部分内容,会在左边给你一段“代码”,右边给你详细的解释,然后从上到下,就是解释“代码”的运行过程。就跟单步调试一样的流程。过程有点像思维训练,刚开始觉得有趣,看到后来觉得枯燥,但是事实上最好多看几遍。
摘记一下五法十诫
Five Laws
The Law of Car:
The primitive car is defined only for non-empty lists
The Law of Cdr:
The primitive cdr is defined only for non-empty lists. The cdr of any non-empty list is always another list.
The Law of Cons:
The primitive cons takes two arguments. The second argument to cons must be a list. The result is a list.
The Law of Null?:
The primitive null? is defined only for lists.
The Law of Eq?:
The primitive eq? takes two arguments. Each must be a non-numeric atom.
Ten Commandments
The First Commandment
When recurring on a list of atoms, lat, ask two questions about it : (null? lat) and else.
When recurring on a number, n, ask two questions about it : (zero? n) and else.
When recurring on a list of S-exp, l, ask three question about it: (null? l), (atom? (car l)), and else.
The Second Commandment
Use cons to build lists.
The Third Commandment
When building a list, describe the first typical element, and then cons it onto the natural recursion.
The Fourth Commandment
Always change at least one argument while recurring.
When recurring on a list of atoms, lat, use (cdr lat).
When recurring on a number, n, use (sub1 n). And when recurring on a list of S-exp, l, use (car l) and (cdr l) if neither (null? l) noe (atom? (car l)) are true.
It must be changed to be closer to termination.
The changing argument must be tested in the termination condition:
when using cdr, test termination with null? and when using sub1, test termination with zero?
The Fifth Commandment
When building a value with o+, always use 0 for the value of the terminating line, for adding 0 does not change the value of an addition.
When building a value with *, always use 1 for the value of the terminating line, for multiplying by 1 does not change the value of a multiplication.
When building a value with cons, always consider () for the value of the terminating line.
The Sixth Commandment
Simplify only after the function is correct.
The Seventh Commandment
Recur on the subparts that are of the same nature:
* On the sublists of a list.
* On the subexpressions of an arithmetic expression.
The Eighth Commandment
Use help function to abstract from representations.
The Ninth Commandment
Abstract common patterns with a new function
[2013-01-15]The Little Schemer 学习笔记的更多相关文章
- 《C++ Primer Plus》15.5 类型转换运算符 学习笔记
C++相对C更严格地限制允许的类型转换,并添加4个类型转换运算符,是转换过程更规范:* dynamic_cast:* const_cast:* static_cast:* reinterpret_ca ...
- 01.第一章_C++ Primer学习笔记_开始
1.2 初始输入输出 iostream库里面包含两个基础类型istream和ostream,分别表示输入流和输出流,一个流就是一个字符序列,从IO设备读出或者写入IO设备. 标准的输入输出对象 标准库 ...
- 2018/2/15 ES Beats的学习笔记
Beats其实是几种服务的统称(你也可以把收集到的数据存储到别的数据源,不一定非要ES),这几种服务分别是: 1.PacketBeat 通过抓包的方式来监控一些服务.如:HTTP,DNS,Redis, ...
- 2015.05.15,外语,学习笔记-《Word Power Made Easy》 01 “如何讨论人格特点”
2015.03.17,外语,读书笔记-<Word Power Made Easy> 01 “如何讨论人格特点”学习笔记 SESSIONS 1 本来这些章节都是在一两年前学习的,现在趁给友人 ...
- 20145213《Java程序设计》第八周学习笔记
20145213<Java程序设计>第八周学习笔记 教材学习内容总结 "桃花春欲尽,谷雨夜来收"谷雨节气的到来意味着寒潮天气的基本结束,气温回升加快.刚出冬的我对于这种 ...
- 20145213《Java程序设计学习笔记》第六周学习总结
20145213<Java程序设计学习笔记>第六周学习总结 说在前面的话 上篇博客中娄老师指出我因为数据结构基础薄弱,才导致对第九章内容浅尝遏止地认知.在这里我还要自我批评一下,其实我事后 ...
- NuGet学习笔记(2) 使用图形化界面打包自己的类库[转]
http://www.cnblogs.com/lzrabbit/archive/2012/05/01/2477607.html 上文NuGet学习笔记(1) 初识NuGet及快速安装使用说到NuGet ...
- 【Cocos2d-x】学习笔记目录
从2019年7月开始学习游戏引擎Cocos2dx,版本3.17. 学习笔记尽量以白话的形式表达自己对源码的理解,而不是大篇幅复制粘贴源码. 本人水平有限,欢迎批评指正! Cocos2d-x 学习笔记 ...
- Puppet学习笔记(CentOS6.3+Puppet3.01)
Puppet学习笔记(CentOS6.3+Puppet3.01) 技术 Add comments Oct262012 下了决心,好好学习puppet,周末专门去参加一个puppet的培训,难得朋友那 ...
随机推荐
- OC中单例的使用
单例:一个类只能创建一个实例,保证在全局使用过程中是唯一的实例,方便统一管理. 1> 创建单例 其中的dispatch_once 的作用就是执行且在整个程序的声明周期中,仅执行一次某一个bloc ...
- 初始jvm(一)---jvm内存区域与溢出
jvm内存区域与溢出 为什么学习jvm 木板原理,最短的一块板决定一个水的深度,当一个系统垃圾收集成为瓶颈的时候,那么就需要你对jvm的了解掌握. 当一个系统出现内存溢出,内存泄露的时候,因为你懂jv ...
- ue4粒子实现流血效果
---恢复内容开始--- 动作/射击游戏中,击中角色时常常伴随着血花效果,增强打击感的同时,也方便了玩家对命中与否的判断. 血液效果分两块,首先是受伤部位在受击瞬间产生血雾粒子,然后在身体.地面.墙面 ...
- 文科生细谈学习Linux系统的重要性
首先大概介绍下自己,我学的是公共事业管理方面的专业,可以说是面向纯理论,社区管理社会管理的专业,但是从大二开始,对网络及服务器运维方面产生浓厚兴趣,并不断在网上找相关资料. 在这期间经历过很多,单说桌 ...
- linux下怎么卸载自带的JDK和安装想要的JDK
linux下怎么卸载自带的JDK和安装想要的JDK 安装linux系统后,系统有自带jdk的版本,因为系统中的有些软件需要使用此环境.但时候我们安装eclipse和tomcat的时候,使用此jdk ...
- 浅谈Vue不同场景下组件间的数据交流
浅谈Vue不同场景下组件间的数据“交流” Vue的官方文档可以说是很详细了.在我看来,它和react等其他框架文档一样,讲述的方式的更多的是“方法论”,而不是“场景论”,这也就导致了:我们在阅读完 ...
- curl---一款实用的URL命令行网络通讯工具/库
最近一段时间在看朴灵翻译的<深入浅出nodejs>,里面有提到一种脱离浏览器的客户端网络通讯工具,curl命令,自己在电脑上试了一下,感觉非常好用,而且莫名的感觉这是一个非常强大的网络工具 ...
- Spring整合CXF webservice restful 实例
webservice restful接口跟soap协议的接口实现大同小异,只是在提供服务的类/接口的注解上存在差异,具体看下面的代码,然后自己对比下就可以了. 用到的基础类 User.java @Xm ...
- 【思维】【水】 南阳oj 喷水装置(一)
描述 现有一块草坪,长为20米,宽为2米,要在横中心线上放置半径为Ri的喷水装置,每个喷水装置的效果都会让以它为中心的半径为实数Ri(0<Ri<15)的圆被湿润,这有充足的喷水装置i(1& ...
- Webservice 中涉及的几个概念
开发webservice有一段时间了.但是对其中的协议及实现一直存在疑惑.这里搜集相关概念.用以更好的理解它. 一.什么是Webservice WebService是一种跨编程语言和跨操作系统平台的远 ...