"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,用户界面)事件:当用户与页面上的元素交 ...
随机推荐
- 玩转Windows服务系列——使用Boost.Application快速构建Windows服务
玩转Windows服务系列——创建Windows服务一文中,介绍了如何快速使用VS构建一个Windows服务.Debug.Release版本的注册和卸载,及其原理和服务运行.停止流程浅析分别介绍了Wi ...
- innerHTML和innerText的区别
以<p id="example">welcome to <strong>JavaScript</strong> !!!</p>为例: ...
- iOS集成sharesdk遇到的坑
分享新浪微博 ★★★分享新浪微博★★★ 前言: 写这个目地是为了记录那些过坑,直接先上效果图.大家看看如果你遇到了应该如果处理更好,因为刚一看到这个效果的时候就明白其实很简单不就是分享微博吧.但是要求 ...
- 设计模式之依赖倒转原则(DIP)
1.概念 DIP:Dependency Inversion Principle 抽象不应当依赖于细节,细节应当依赖于抽象(说通俗点也就是要针对接口编程,不要针对实现编程:或者要依赖于抽象,不要依赖于具 ...
- JavaScript权威设计--Window对象(简要学习笔记十三)
1.Window对象是所有客户端JavaScript特性和API的主要接入点. Window对象中的一个重要属性是document,它引用Document对象. JavaScript程序可以通过Doc ...
- react+redux教程(七)自定义redux中间件
今天,我们要讲解的是自定义redux中间件这个知识点.本节内容非常抽象,特别是中间件的定义原理,那多层的函数嵌套和串联,需要极强逻辑思维能力才能完全消化吸收.不过我会多罗嗦几句,所以不用担心. 例子 ...
- TortoiseSVN的使用
1.安装和下载client客户端 (1)下载windows端程序:http://tortoisesvn.net/downloads.一般而言,如果是32bit操作系统,运行TortoiseSVN-1. ...
- 【Java心得总结一】Java基本类型和包装类型解析
说到数据类型这个问题是一个基本的不能再基本的问题,我们当初编程入门第一课一般就是讲数据类型,而今天我想记录的是一个在Java中容易忽略的问题,即基本类型和包装类型. 一.基本类型出现的原因 我们都知道 ...
- dicom网络通讯入门(3)
接下来可以进行消息传递了 ,也就是dimse ,再来复习下 什么是dimse .n-set n-create c-echo 这些都是dimse 他们都是属于一种结构的pdu 那就是tf-pdu(传 ...
- [Asp.net 5] Options-配置文件(2)
很久之前写过一篇介绍Options的文章,2016年再打开发现很多变化.增加了新类,增加OptionMonitor相关的类.今天就对于这个现在所谓的新版本进行介绍. 老版本的传送门([Asp.net ...