From 036d2daf3c01ec36df2a9fb72dbc8540484d43fc Mon Sep 17 00:00:00 2001 From: dmitriz Date: Sun, 9 Jun 2019 19:44:46 +0700 Subject: [PATCH] docs(readme): update docs --- README.md | 1 - index.js | 20 ++++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 94ddd88..74865e2 100644 --- a/README.md +++ b/README.md @@ -261,7 +261,6 @@ const redn = (acc, y1, y2, ...) => ... New CPS function whose output from the first callback is the accumulated value. For each output `(y1, y2, ...)` from the `n`th callback, the `n`th reducer `redn` is used to compute the new acculated value `redn(acc, y1, y2, ...)`, where `acc` starts with `init`, similar to `reduce`. -The new accumulated value is passed as output into the first callback. #### Example of `scan` diff --git a/index.js b/index.js index 2fe7814..cc378ce 100644 --- a/index.js +++ b/index.js @@ -179,14 +179,16 @@ const filter = (...preds) => { * @signature (...reducers, init) -> cpsAction -> cpsState * * @param {...Function} reducers - * - functions of the form `red = (acc, ...val) => newAcc` - * @param {...*} vals - tuple of arbitrary values. + * - functions of the form `red = (acc, ...vals) => newAcc` + * @param {*} init - initial value for the iteration. * @param {Function} cpsFn - CPS function. - * @returns {Function} `scan(...reducers)(...vals)(cpsFn)` - * - CPS function whose nth callback - * receives the outputs obtained by iterating - * the stream of outputs from the nth callback of `cpsFn` - * over `reducers[n]` starting from with `vals[n]`. + * @returns {Function} `scan(...reducers, init)(cpsFn)` + * - CPS function whose output from the first callback + * is the accumulated value. For each output `(y1, y2, ...)` + * from the `n`th callback of `cpsFn, the `n`th reducer `redn` + * is used to compute the new acculated value + * `redn(acc, y1, y2, ...)`, where `acc` starts with `init`, + * similar to `reduce`. */ const scan = (...args) => { let reducers = args.slice(0,-1), @@ -219,7 +221,9 @@ const objMap = fn => obj => // Prototype methods const protoObj = objMap(apply2this)({ map, - chain + chain, + filter, + scan }) const CPS = cpsFn => {