Skip to content

Commit

Permalink
docs(readme): update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitriz committed Jun 9, 2019
1 parent ba9885f commit 036d2da
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
20 changes: 12 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -219,7 +221,9 @@ const objMap = fn => obj =>
// Prototype methods
const protoObj = objMap(apply2this)({
map,
chain
chain,
filter,
scan
})

const CPS = cpsFn => {
Expand Down

0 comments on commit 036d2da

Please sign in to comment.