"Becoming Functional" 阅读笔记+思维导图

<Becoming Functional>是O'Reilly公司今年(2014)7月发布的一本薄薄的小册子,151页,介绍了函数式编程的基本概念.全书使用代码范例都是基于JVM的编程语言,比如Java,Groovy,Scala.为了能够讲解所有的知识点,作者不得不在多个语言之间做切换,其实使用Erlang,Elixir甚至是C#做范例都不会这么累(因为C#有Linq,Lazy.....).


附文字版
Becoming Functional
First-class functions
can either accept another function as an argument or return a function.
Pure functions
are functions that have no side effects. Side effects are actions a function may perform that are not solely contained within the function itself.
Side Effects
Recursion
allows us to write smaller, more concise algorithms and to operate by looking only at the inputs to our functions.
Tail Recursion
Immutable variables
Immutable variables, once set, cannot be changed.
Nonstrict (Lazy) evaluation
allow us to have variables that have not been computed yet.
Strict evaluations-assigning a variable as soon as it is defined-are what we are used to
Nonstrict means that we can have a variable that does not get assigned (computed) until the first time it is referenced.
Statements
are evaluable pieces of code that have a return value.
Each line of code should be considered a statement, meaning there are very few side effects within the application itself.
Pattern matching
allows us to better type-check and extract elements from an object, making for simpler and more concise statements with less need for variable definitions.
extracting value
First-class functions
Anonymous Functions
closures
Closures are much like lambdas, except they reference variables outside the scope of the function.
In the simplest explanation, the body references a variable that doesn't exist in either the body or the parameter list.
lambda functions
Lambda functions are unnamed functions that contain a parameter list, a body, and a return.
Higher-Order Functions
A function becomes "higher order" if it accepts or returns a function.
Pure functions
Output Depends on Input
When we don't return the result of our execution but rather mutate another external (i.e., not contained within the function scope) object, we call this a side effect.
Pure functions are functions that have no side effects and always perform the same computation,resulting in the same output, given a set of inputs.
Really, you want to make a function pure whenever possible; it makes the function much more testable and improves understandability from a troubleshooting perspective.
"Becoming Functional" 阅读笔记+思维导图的更多相关文章
- C#学习笔记思维导图 一本书22张图
阅读的书是<21天学通C#>博客中有下载 看看总结之后的模块 全部文件 初步展示 数据存储 继承模块 暂时就这些吧 全部思维导图22张打包下载
- 1. sqlmap超详细笔记+思维导图
sqlmap思维导图: 基本操作笔记: -u #注入点 -f #指纹判别数据库类型 -b #获取数据库版本信息 -p #指定可测试的参数(?page=1&id=2 -p "page, ...
- SQL反模式读书笔记思维导图
在写SQL过程以及设计数据表的过程中,我们经常会走一些弯路,会做一些错误的设计.<SQL反模式>这本书针对这些经常容易出错的设计模式进行分析,解释了错误的理由.允许错误的场景,并给出更好的 ...
- 《HTML重构》读书笔记&思维导图
最近读了<HTML重构>这本书,以下做出自己的总结归纳,大家可以一起学习交流. 什么是重构?重构是在不改变程序行为的基础上进行小的改动是代码基本逐渐完善的过程,通常需要一些自动化工具的帮助 ...
- 原创:ASP.Net状态管理读书笔记--思维导图
导图文件下载 课前提问几个问题 使用Session 配置 model aspnet_regsql.exe 常见问答 问:为什么Session在有些机器上偶尔会丢失?答:可能和机器的环境有关系,比如:防 ...
- Don't make me think [读书笔记] [思维导图]
<Don't make me think>第3版 内容:解析用户心理,在用户模式.扫描设计.导航设计.主页布局.可用性测试,提出了许多的独到观点及建议. 特色:语言轻松.实在.配有许多 ...
- ASP.Net状态管理读书笔记--思维导图
课前提问几个问题 使用Session 配置 model aspnet_regsql.exe 常见问答 问:为什么Session在有些机器上偶尔会丢失?答:可能和机器的环境有关系,比如:防火墙或者杀毒软 ...
- JavaScript 中的内存和性能、模拟事件(读书笔记思维导图)
由于事件处理程序可以为现代 Web 应用程序提供交互能力,因此许多开发人员会不分青红皂白地向页面中添加大量的处理程序.在 JavaScript 中,添加到页面上的事件处理程序数量将直接关系到页面的整体 ...
- JavaScript 中的事件类型5(读书笔记思维导图)
Web 浏览器中可能发生的事件有很多类型.如前所述,不同的事件类型具有不同的信息,而“ DOM3级事件”规定了以下几类事件. UI(User Interface,用户界面)事件:当用户与页面上的元素交 ...
随机推荐
- ASP.NET MVC Model元数据(五)
ASP.NET MVC Model元数据(五) 前言 在上一篇中我们描述了应用于Model上面的各种用于显示控制的特性类,在本篇中将详细的介绍这些特性类的应用,虽然它们跟Model元数据的直接关系并不 ...
- Android中自定义样式与View的构造函数中的第三个参数defStyle的意义
零.序 一.自定义Style 二.在XML中为属性声明属性值 1. 在layout中定义属性 2. 设置Style 3. 通过Theme指定 三.在运行时获取属性值 1. View的第三个构造函数的第 ...
- Atitit ABI FFI 的区别与联系 attilax总结
Atitit ABI FFI 的区别与联系 attilax总结 FFI stands for Foreign Function Interface. A foreign function interf ...
- APP测试点总结(功能,交互,死机崩溃状态分析,容易出错的检查点)
APP测试点总结(功能,交互,死机崩溃状态分析,容易出错的检查点) 版权声明:本文为博主原创文章,未经博主允许不得转载. 最近涉足APP端测试,常见检查点总结如下: 一.业务方面: 1. 注册( ...
- redis的面试题
1:使用redis有哪些好处? (1) 速度快,因为数据存在内存中,类似于HashMap,HashMap的优势就是查找和操作的时间复杂度都是O(1) (2) 支持丰富数据类型,支持string,lis ...
- seajs的使用
写在前面 seajs是什么? Seajs是一个js文件加载器. 遵循 CMD 规范模块化开发,依赖的自动加载.配置的简洁清晰. 用于Web开发的模块加载工具,提供简单.极致的模块化体验 一:使用 文件 ...
- GC使用注意
GC.Collect() GC.WaitForPendingFinallizers() GC.KeepAlive 尽量不要new很大的Object 不要频繁的new生命周期很短的Object,这样会导 ...
- 前端学HTTP之网关、隧道和中继
前面的话 Web是一种强大的内容发布工具.人们已经从只在网上发送静态的在线文档,发展到共享更复杂的资源,比如数据库内容或动态生成的HTML页面.Web浏览器为用户提供了一种统一的方式来访问因特网上的内 ...
- plsql查询乱码问题解决
步骤一:新建变量,设置变量名:NLS_LANG,变量值:SIMPLIFIED CHINESE_CHINA.ZHS16GBK,确定即可: 步骤二: 退出plsql,重新登陆plsql.输入sql语句,执 ...
- android 在 ListView 的 item 中插入 GridView 仿微信朋友圈图片显示。
转载请声明出处(http://www.cnblogs.com/linguanh/) 先上张效果图: 1,思路简述 这个肯定是要重写 baseAdapter的了,这里我分了两个数据适配器,一个是自定义的 ...