"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 Web API 控制器创建过程(一)
ASP.NET Web API 控制器创建过程(一) 前言 在前面对管道.路由有了基础的了解过后,本篇将带大家一起学习一下在ASP.NET Web API中控制器的创建过程,这过程分为几个部分下面的内 ...
- 细说websocket - php篇
下面我画了一个图演示 client 和 server 之间建立 websocket 连接时握手部分,这个部分在 node 中可以十分轻松的完成,因为 node 提供的 net 模块已经对 socket ...
- ABP源码分析四十四:ZERO的配置
ABP Zero模块中需要配置的地方主要集中在三块:配置静态的role,配置外部认证源,以及配置本地化语言和资源. UserManagementConfig/IUserManagementConfig ...
- Entity Framework 6 Recipes 2nd Edition(10-1)译->非Code Frist方式返回一个实体集合
存储过程 存储过程一直存在于任何一种关系型数据库中,如微软的SQL Server.存储过程是包含在数据库中的一些代码,通常为数据执行一些操作,它能为数据密集型计算提高性能,也能执行一些为业务逻辑. 当 ...
- Atitit 软件架构方法的进化与演进cs bs soa roa msa attilax总结
Atitit 软件架构方法的进化与演进cs bs soa roa msa attilax总结 1.1. 软件体系架构是沿着单机到 CS 架构,再到 BS 的三层架构甚至多层架构逐步发展过来的,关于 ...
- PagerSlidingTabStrip介绍及使用,让ViewPager更绚丽
转载请注明出处http://blog.csdn.net/harryweasley/article/details/42290595,谢谢. 以前一直想着,ViewPager中间的那个横线怎么跟着屏幕的 ...
- 【Win 10应用开发】延迟共享
延迟共享是啥呢,这么说吧,就是在应用程序打开共享面板选择共享目标时,不会设置要共享的数据,而是等到共享目标请求数据时,才会发送数据,而且,延迟操作可以在后台进行. 这样说似乎过于抽象,最好的诠释方法, ...
- JavaScript语言精粹--执行环境及作用域,this
1.执行环境定义了变量或函数有权访问的其他数据,决定了他们各自的行为. 每个执行环境都有一个与之关联的变量对象,环境中定义的所有变量和函数都保存在这个对象中. 虽然我们无法访问,但是解析器在处理数据时 ...
- CSS3 Notes: -webkit-box-reflect实现倒影
平常我们要实现倒影的效果,一般的做法是使用多个DOM元素绝对定位+scale(负-1)或者rotate.这种方法的缺点是占据空间以及DOM元素过多. 在使用webkit内核的浏览器中(chrome,s ...
- 前端MVC学习总结(二)——AngularJS验证、过滤器、指令
一.验证 angularJS中提供了许多的验证指令,可以轻松的实现验证,只需要在表单元素上添加相应的ng属性,常见的如下所示: <input Type="text" ng-m ...