Skip to content

Instantly share code, notes, and snippets.

@jasonbellamy
Created October 19, 2016 04:32
Show Gist options
  • Save jasonbellamy/b261dd3cdd54047651a2ffc84def71f5 to your computer and use it in GitHub Desktop.
Save jasonbellamy/b261dd3cdd54047651a2ffc84def71f5 to your computer and use it in GitHub Desktop.
recursive implementation of foldWith
const foldWith = (fn, terminal, [head, ...tail]) => (
(head === void 0) ? terminal : fn(head, foldWith(fn, terminal, tail))
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment