-
There are two variants of fold, left associative versus right.
What about naming them `fold_left` and `fold_right`?
Given an adaptor that results in a variadic function as `compress`
compress:: F …
-
[原文地址](https://github.com/joeyguo/blog/issues/10)
函数式编程 ( Functional Programming ) 是一种以函数为基础的编程方式和代码组织方式,能够带来更好的代码调试及项目维护的优势。[本篇](https://github.com/joeyguo/blog/issues/10)主要结合笔者在实际项目开发中的一些应用,简要谈谈函…
-
### 说明
学过JavaScript这门语言的同学想必都听说过闭包一词, **闭包**在日常开发中用的也是非常广泛的。可是当面试问你闭包是什么的时候,总感觉说不到点上。究竟什么是**闭包**呢?它是怎么起作用的?如何使用闭包去简化开发?如何用闭包提高性能以及如何用闭包解决作用域的问题?本文就为大家解开闭包的真面纱。
### 闭包
首先要知道什么是闭包就得知道闭包是怎么产生的。在javasc…
-
## 用法
### produce
1. 修改原有的数据this.state,生成全新的state,draft就是this.state
```js
this.setState(
produce(this.state, draft => {
draft.user.age += 1;
})
);
```
由于setState接受一个函…
cisen updated
5 years ago
-
Why path isn't curried? (I mean ones with mapped types).
And why `T` was replaced with `T | undefined` in last update?
-
-
Sometimes features in the compiler are ready ahead of time, but for some reason they belong to the next version of the compiler.
Instead of letting them leave in some branch, that needs rebasing and …
-
[RFC FS-1073](https://github.com/fsharp/fslang-design/blob/master/RFCs/FS-1073-record-constructors.md)
### F# has concise syntax for defining records:
```fsharp
type PensionData =
{ Name:str…
-
# 纯函数
[这篇文章](http://eyasweb.com/#/blog/detail/6) 简单的介绍了一下纯函数
现在再来简单的概括一下:
> 纯函数就是相同的输入,永远都会有相同的输出,没有任何可观察的副作用
一个函数,如果与外界完全没有任何联系,那么内部的逻辑完全不受外界影响,所以永远会有相同的输出,如:
``` js
let addOne = x => x+1
```
他…
-
The only thing required to support dependency injection with function programming is a feature-flag in the configuration file which tells the container not to treat the first argument as an invocant.