There is a cycle, a rhythm to the universe.

Today one program will be popular, tomorrow another.

Today 500 bugs will be fixed, tomorrow another 500 will appear.

To understand life is to know that the rhythm exists.

To understand Zen is to live outside this rhythm,

detached from the everyday concerns of life.

Only then can the mind be free.

—- 摘自《The Tao of Programming（编程之道）》

FRP组合了响应式编程（Reactive Programming – RP）与函数式编程（Functional Programming – FP）。

“Be water, my friend. ”

“把运算过程尽量写成一系列嵌套的函数调用”（函数式编程初探 – 阮一峰的网络日志）。

《The introduction to Reactive Programming you’ve been missing》
https://gist.github.com/staltz/868e7e9bc2a7b8c1f754

“灰色的矩形是把一个 stream 转换成另一个 stream 的函数。我们会每隔 250ms 把所有 click stream 都缓冲在一个数组里面，这是 buffer(stream.throttle(250ms)) 所要做的事情。

``````var multiClickStream = clickStream
.buffer(function() { return clickStream.throttle(250); })
.map(function(list) { return list.length; })
.filter(function(x) { return x >= 2; });

``````

``````multiClickStream.subscribe(function (numclicks) {
console.log(numclicks);
)};

``````

stream.buffer().map().filter()

stream – buffer() – map() – filter()

ODOT 基于 OSC，就是那个熟悉的 Open Sound Control。

o.pack 是把流入的 stream 数据，封装成 OSC 格式。

``````/data = length(/data) ; //取长度

o.if /data >= 2 ; //过滤2以上的数据。

``````

```上述例子源文件： https://github.com/avantcontra/maxmsp_examples/tree/master/functional_programming```

ODOT 还可以实现更多函数式特征的功能

ODOT 下载

《Composability for Musical Gesture Signal Processing using new OSC-based Object and Functional Programming Extensions to Max/MSP》

《DYNAMIC, INSTANCE-BASED, OBJECT-ORIENTED PROGRAMMING IN MAX/MSP USING OPEN SOUND CONTROL MESSAGE DELEGATION》

Today 500 bugs will be fixed, tomorrow another 500 will appear.

HUDO.IT on Slack: hudoit.herokuapp.com