Skip to content

Instantly share code, notes, and snippets.

@christianwish
Created June 17, 2020 21:28
Show Gist options
  • Save christianwish/79d8f5e56615ecf9c9930908ae060b82 to your computer and use it in GitHub Desktop.
Save christianwish/79d8f5e56615ecf9c9930908ae060b82 to your computer and use it in GitHub Desktop.
const isGreateThan = n => m => (m > n);
const square = x => x * x;
const filter = f => arr => arr.filter(f);
const map = f => arr => arr.map(f);
const reduce = f => arr => arr.reduce(f);
const includes = v => arr => arr.includes(v);
const applyTo = x => f => f(x);
const all = f => arr => arr.filter(f).length === arr.length;
const data = [1, 2, 3, 4, 5, 13];
const filterGreater3 = filter(isGreateThan(3));
const mapSquare = map(square);
const result = all(isGreateThan(3))(data);
console.log(result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment