UNPKG

993 BMarkdownView Raw
1# Functional Programming Library - Explanations
2
3## Transforms
4### Neighbors
5
6Stream processing may not be an intuitive programming paradigm. Most problems which are addressed only need to work with small data sets where it is possible to iterate over the set to compute an appropriate transformation. With a large data set this is not possible.
7
8The neighbors transform is created to produce a traditional bounded context from an (potentially) infinite stream.
9
10The transform keeps track of a limited array of data from the stream and presents this along with a specific stream event back into the stream. This makes it simply to use aggregate functions which expect a bounded set of data...such as average or standard deviation.
11
12Imagine a stream
13```
141
152
163
174
185
19...```
20
21The neighbors(3) transform produces
22```
23data: 1 neighbors:[1,2,3]
24data: 2 neighbors:[2,3,4]
25data: 3 neighbors:[3,4,5]
26```
27
28You can then use the neighbors array to compare the nth value to its n to n+m neighbors.
29
30
31
32
\No newline at end of file