"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,用户界面)事件:当用户与页面上的元素交 ...
随机推荐
- 详解this
this 虐我千百遍,看完此文效立见!不得不说,这篇文章的总结很地道很全面,适合收藏之用. 原文:all this 习惯了高级语言的你或许觉得JavaScript中的this跟Java这些面向对象语言 ...
- 快速Android开发系列网络篇之Android-Async-Http
先来看一下最基本的用法 AsyncHttpClient client = new AsyncHttpClient(); client.get("http://www.google.com&q ...
- Entity Framework 6 Recipes 2nd Edition(12-1)译 -> 当SaveChanges( ) 被调用时执行你的代码
第12章定制EF 在本章的小节里,定制实体对象和EF处理的一些功能.这些小节将涵盖很多”幕后”的事情,能让你的代码更加统一解决一些事情,比如用一个业务规则中心统一地为实体执行验证. 本章开始的小节,将 ...
- 简化SSH框架的整合
一.开发环境: (1) OS:Windows 7 (2) DB:MySql 5.1.6 (3) JDK:1.8.0_17 (4) Server:Apache Tomcat 8. ...
- 利用select实现IO多路复用TCP服务端
一.相关函数 1. int select(int maxfdp, fd_set *readset, fd_set *writeset, fd_set *exceptset,struct timeva ...
- AngularJS之一个元素上绑定多个指令作用域
前言 众所周知,我们在自定义指令时,会指定它的作用域,即scope设置项(默认值为false). 且,scope设置项,可以有三种值,从而也就代表三种不同的作用域,下面我们再来一起回顾下: 指令之sc ...
- 原生js之四步走搞定Ajax
说到Ajax,不得不先提一下HTTP(HTTP,HyperText Transfer Protocol)协议,中文名:超文本传输协议,是互联网上应用最为广泛的一种网络协议.所有的WWW文件 ...
- 学会用bootstrap的modal和carousel
bootstrap框架提供了很多好用的javascript组件,可以很方便的实现常用的js效果,比如点击弹出一个div(modal).下拉菜单.旋转木马(carousel或slider),非常适合前端 ...
- CSS3属性 box-shadow 向框添加一个或多个阴影
CSS3属性 利用box-shadow制作网页页眉背景 box-shadow 浏览器支持 IE9+.Firefox 4.Chrome.Opera 以及 Safari 5.1.1 支持 box-shad ...
- PID控制
PID解释: 位置式: 可以看出,比例部分只与当前的偏差有关,而积分部分则是系统过去所有偏差的累积.位置式PI调节器的结构清晰,P和I两部分作用分明,参数调整简单明了.但直观上看,要计算第拍 ...