ciaoly 2019年10月30日
• 在其它设备中阅读本文章

# 响应式编程 ---- 笔记

## 从 "点击事件" 说起

dom.addEventListener("click", event => {console.log(event)});

1. event (stream) 为什么是"事件流"而不是"dom"?
3. callback function

## 对 "流" 附加操作

1. 每次水源处有水流出都会经过处理装置处理(并最终可能会到达下游的机器);
2. 水流每经过一层 处理装置 都会将处理结果"累积"到下一层

// TODO

## 再究 "响应式"

For example, in an imperative programming setting, a := b + c would mean that a is being assigned the result of b+c in the instant the expression is evaluated, and later, the values of b and c can be changed with no effect on the value of a. On the other hand, in reactive programming, the value of a is automatically updated whenever the values of b or c change, without the program having to re-execute the statement a:=b+c to determine the presently assigned value of a [citation needed]

Another example is a hardware description language such as Verilog, where reactive programming enables changes to be modeled as they propagate through circuits.[citation needed]

    wire [3:0] t2,t3,t4;
wire [3:0] d1,d2,d3,d4;
assign d4 = {1'b0, hex[5:3]};
assign d3 = {t4[2:0], hex[2]};
assign d2 = {t3[2:0], hex[1]};
assign d1 = {t2[2:0], hex[0]};

// TODO 实操文首的博客中的实例, 再记录.