main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
854 bytes
|
Line | |
---|
1 | var _curry3 =
|
---|
2 | /*#__PURE__*/
|
---|
3 | require("./_curry3.js");
|
---|
4 |
|
---|
5 | var _xfBase =
|
---|
6 | /*#__PURE__*/
|
---|
7 | require("./_xfBase.js");
|
---|
8 |
|
---|
9 | var tInit = '@@transducer/init';
|
---|
10 | var tStep = '@@transducer/step';
|
---|
11 |
|
---|
12 | var XScan =
|
---|
13 | /*#__PURE__*/
|
---|
14 | function () {
|
---|
15 | function XScan(reducer, acc, xf) {
|
---|
16 | this.xf = xf;
|
---|
17 | this.f = reducer;
|
---|
18 | this.acc = acc;
|
---|
19 | }
|
---|
20 |
|
---|
21 | XScan.prototype[tInit] = function () {
|
---|
22 | return this.xf[tStep](this.xf[tInit](), this.acc);
|
---|
23 | };
|
---|
24 |
|
---|
25 | XScan.prototype['@@transducer/result'] = _xfBase.result;
|
---|
26 |
|
---|
27 | XScan.prototype[tStep] = function (result, input) {
|
---|
28 | if (result['@@transducer/reduced']) {
|
---|
29 | return result;
|
---|
30 | }
|
---|
31 |
|
---|
32 | this.acc = this.f(this.acc, input);
|
---|
33 | return this.xf[tStep](result, this.acc);
|
---|
34 | };
|
---|
35 |
|
---|
36 | return XScan;
|
---|
37 | }();
|
---|
38 |
|
---|
39 | var _xscan =
|
---|
40 | /*#__PURE__*/
|
---|
41 | _curry3(function _xscan(reducer, acc, xf) {
|
---|
42 | return new XScan(reducer, acc, xf);
|
---|
43 | });
|
---|
44 |
|
---|
45 | module.exports = _xscan; |
---|
Note:
See
TracBrowser
for help on using the repository browser.