Skip to content

Instantly share code, notes, and snippets.

@dinocarl
Last active November 12, 2020 04:35
Show Gist options
  • Save dinocarl/b11c420284e8642556b2b21c8ab09c31 to your computer and use it in GitHub Desktop.
Save dinocarl/b11c420284e8642556b2b21c8ab09c31 to your computer and use it in GitHub Desktop.
JS Scan function
const apCh = (fn, accVal) => (item) => accVal = fn(accVal, item);
const scanr = curry((fn, acc, xs) => map(
apCh(fn, acc),
xs
))
scanr(add, 0)(
[5,6,7,8]
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment